Skip to content

Commit 27c221b

Browse files
committed
ensure leaving transitions are up-to-date for dynamic transitions
1 parent d94f113 commit 27c221b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/platforms/web/runtime/components/transition-group.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default {
6161
const removed = []
6262
for (let i = 0; i < prevChildren.length; i++) {
6363
const c = prevChildren[i]
64+
c.data.transition = transitionData
6465
c.data.pos = c.elm.getBoundingClientRect()
6566
if (map[c.key]) {
6667
kept.push(c)

src/platforms/web/runtime/components/transition.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// supports transition mode (out-in / in-out)
55

66
import { warn } from 'core/util/index'
7-
import { camelize } from 'shared/util'
7+
import { camelize, extend } from 'shared/util'
88
import { getRealChild, mergeVNodeHook } from 'core/vdom/helpers'
99

1010
export const transitionProps = {
@@ -100,9 +100,12 @@ export default {
100100
const oldRawChild = this._vnode
101101
const oldChild: any = getRealChild(oldRawChild)
102102

103-
// handle transition mode
104-
if (mode && oldChild && oldChild.data && oldChild.key !== child.key) {
105-
const oldData = oldChild.data.transition
103+
if (oldChild && oldChild.data && oldChild.key !== child.key) {
104+
// replace old child transition data with fresh one
105+
// important for dynamic transitions!
106+
const oldData = oldChild.data.transition = extend({}, data)
107+
108+
// handle transition mode
106109
if (mode === 'out-in') {
107110
// return empty node and queue update when leave finishes
108111
mergeVNodeHook(oldData, 'afterLeave', () => {

0 commit comments

Comments
 (0)