diff --git a/packages/mixins/transition.ts b/packages/mixins/transition.ts index 7aa9d751..044f6daa 100644 --- a/packages/mixins/transition.ts +++ b/packages/mixins/transition.ts @@ -53,7 +53,8 @@ export function transition(showDefaultValue: boolean) { }, enter() { - this.waitEnterEndPromise = new Promise((resolve) => { + if (this.enterFinishedPromise) return; + this.enterFinishedPromise = new Promise((resolve) => { const { duration, name } = this.data; const classNames = getClassNames(name); const currentDuration = isObj(duration) ? duration.enter : duration; @@ -93,8 +94,8 @@ export function transition(showDefaultValue: boolean) { }, leave() { - if (!this.waitEnterEndPromise) return; - this.waitEnterEndPromise.then(() => { + if (!this.enterFinishedPromise) return; + this.enterFinishedPromise.then(() => { if (!this.data.display) { return; } @@ -124,7 +125,10 @@ export function transition(showDefaultValue: boolean) { } this.transitionEnded = false; - setTimeout(() => this.onTransitionEnd(), currentDuration); + setTimeout(() => { + this.onTransitionEnd(); + this.enterFinishedPromise = null; + }, currentDuration); this.setData({ classes: classNames['leave-to'] }); });