From 5882a0e3b57576d228252bc5f0882ab5e6ddff2e Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 29 Jun 2016 21:37:31 -0400 Subject: [PATCH] transition: onEnter -> enter, onLeave -> leave, onAppear -> appear (ref #3172) --- .../web/runtime/modules/transition.js | 13 ++++---- .../features/transition/transition.spec.js | 32 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/platforms/web/runtime/modules/transition.js b/src/platforms/web/runtime/modules/transition.js index d228b21b..9647bab0 100644 --- a/src/platforms/web/runtime/modules/transition.js +++ b/src/platforms/web/runtime/modules/transition.js @@ -51,17 +51,16 @@ export function enter (vnode: VNodeWithData) { const { css, - appear, enterClass, enterActiveClass, appearClass, appearActiveClass, beforeEnter, - onEnter, + enter, afterEnter, enterCancelled, beforeAppear, - onAppear, + appear, afterAppear, appearCancelled } = resolveTransition(data, vnode.context) @@ -74,7 +73,7 @@ export function enter (vnode: VNodeWithData) { const startClass = isAppear ? appearClass : enterClass const activeClass = isAppear ? appearActiveClass : enterActiveClass const beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter - const enterHook = isAppear ? (onAppear || onEnter) : onEnter + const enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter const afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter const enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled @@ -130,14 +129,14 @@ export function leave (vnode: VNodeWithData, rm: Function) { leaveClass, leaveActiveClass, beforeLeave, - onLeave, + leave, afterLeave, leaveCancelled, delayLeave } = resolveTransition(data, vnode.context) const expectsCSS = css !== false - const userWantsControl = onLeave && onLeave.length > 2 + const userWantsControl = leave && leave.length > 2 const cb = el._leaveCb = once(() => { if (expectsCSS) { removeTransitionClass(el, leaveActiveClass) @@ -172,7 +171,7 @@ export function leave (vnode: VNodeWithData, rm: Function) { } }) } - onLeave && onLeave(el, vm, cb) + leave && leave(el, vm, cb) if (!expectsCSS && !userWantsControl) { cb() } diff --git a/test/unit/features/transition/transition.spec.js b/test/unit/features/transition/transition.spec.js index d2ace11d..8324d154 100644 --- a/test/unit/features/transition/transition.spec.js +++ b/test/unit/features/transition/transition.spec.js @@ -126,8 +126,8 @@ if (!isIE9) { }) it('inline transition object', done => { - const onEnter = jasmine.createSpy('enter') - const onLeave = jasmine.createSpy('leave') + const enter = jasmine.createSpy('enter') + const leave = jasmine.createSpy('leave') const vm = new Vue({ template: `