Skip to content

Commit

Permalink
fix dynamic transition type for higher-order transition components (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 27, 2016
1 parent 7f25f73 commit 2540c37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/platforms/web/runtime/components/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ function hasParentTransition (vnode) {
}
}

function isSameChild (child, oldChild) {
return oldChild.key === child.key && oldChild.tag === child.tag
}

export default {
name: 'transition',
props: transitionProps,
Expand Down Expand Up @@ -126,11 +130,10 @@ export default {
const oldRawChild = this._vnode
const oldChild: any = getRealChild(oldRawChild)

if (oldChild && oldChild.data && oldChild.key !== key) {
if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
// replace old child transition data with fresh one
// important for dynamic transitions!
const oldData = oldChild.data.transition = extend({}, data)

const oldData = oldChild && (oldChild.data.transition = extend({}, data))
// handle transition mode
if (mode === 'out-in') {
// return placeholder node and queue update when leave finishes
Expand Down

0 comments on commit 2540c37

Please sign in to comment.