diff --git a/packages/runtime-dom/src/components/Transition.ts b/packages/runtime-dom/src/components/Transition.ts index f33d4136..0c1a30f6 100644 --- a/packages/runtime-dom/src/components/Transition.ts +++ b/packages/runtime-dom/src/components/Transition.ts @@ -174,9 +174,11 @@ export function resolveTransitionProps( done && done() } - let isLeaving = false - const finishLeave = (el: Element, done?: () => void) => { - isLeaving = false + const finishLeave = ( + el: Element & { _isLeaving?: boolean }, + done?: () => void + ) => { + el._isLeaving = false removeTransitionClass(el, leaveFromClass) removeTransitionClass(el, leaveToClass) removeTransitionClass(el, leaveActiveClass) @@ -223,8 +225,8 @@ export function resolveTransitionProps( }, onEnter: makeEnterHook(false), onAppear: makeEnterHook(true), - onLeave(el, done) { - isLeaving = true + onLeave(el: Element & { _isLeaving?: boolean }, done) { + el._isLeaving = true const resolve = () => finishLeave(el, done) addTransitionClass(el, leaveFromClass) if (__COMPAT__ && legacyClassEnabled) { @@ -234,7 +236,7 @@ export function resolveTransitionProps( forceReflow() addTransitionClass(el, leaveActiveClass) nextFrame(() => { - if (!isLeaving) { + if (!el._isLeaving) { // cancelled return }