diff --git a/src/platforms/web/runtime/components/transition-group.js b/src/platforms/web/runtime/components/transition-group.js index 4f532e4e..cd0cc1b7 100644 --- a/src/platforms/web/runtime/components/transition-group.js +++ b/src/platforms/web/runtime/components/transition-group.js @@ -61,6 +61,7 @@ export default { const removed = [] for (let i = 0; i < prevChildren.length; i++) { const c = prevChildren[i] + c.data.transition = transitionData c.data.pos = c.elm.getBoundingClientRect() if (map[c.key]) { kept.push(c) diff --git a/src/platforms/web/runtime/components/transition.js b/src/platforms/web/runtime/components/transition.js index 04586968..ddc1f754 100644 --- a/src/platforms/web/runtime/components/transition.js +++ b/src/platforms/web/runtime/components/transition.js @@ -4,7 +4,7 @@ // supports transition mode (out-in / in-out) import { warn } from 'core/util/index' -import { camelize } from 'shared/util' +import { camelize, extend } from 'shared/util' import { getRealChild, mergeVNodeHook } from 'core/vdom/helpers' export const transitionProps = { @@ -100,9 +100,12 @@ export default { const oldRawChild = this._vnode const oldChild: any = getRealChild(oldRawChild) - // handle transition mode - if (mode && oldChild && oldChild.data && oldChild.key !== child.key) { - const oldData = oldChild.data.transition + if (oldChild && oldChild.data && oldChild.key !== child.key) { + // replace old child transition data with fresh one + // important for dynamic transitions! + const oldData = oldChild.data.transition = extend({}, data) + + // handle transition mode if (mode === 'out-in') { // return empty node and queue update when leave finishes mergeVNodeHook(oldData, 'afterLeave', () => {