Skip to content

Commit bb58b2d

Browse files
committed
tweak transition appear check
1 parent 2d58d0e commit bb58b2d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { inBrowser } from 'core/util/index'
44
import { isIE9 } from 'web/util/index'
55
import { cached, extend } from 'shared/util'
66
import { mergeVNodeHook } from 'core/vdom/helpers'
7+
import { activeInstance } from 'core/instance/lifecycle'
78
import {
89
nextFrame,
910
addTransitionClass,
@@ -47,8 +48,17 @@ export function enter (vnode: VNodeWithData) {
4748
appearCancelled
4849
} = data
4950

50-
const context = vnode.context.$parent || vnode.context
51+
// activeInstance will always be the <transition> component managing this
52+
// transition. One edge case to check is when the <transition> is placed
53+
// as the root node of a child component. In that case we need to check
54+
// <transition>'s parent for appear check.
55+
const transitionNode = activeInstance.$vnode
56+
const context = transitionNode && transitionNode.parent
57+
? transitionNode.parent.context
58+
: activeInstance
59+
5160
const isAppear = !context._isMounted || !vnode.isRootInsert
61+
5262
if (isAppear && !appear && appear !== '') {
5363
return
5464
}

0 commit comments

Comments
 (0)