mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 02:57:43 +08:00
fix transition insert hook duplicate invocation on slot nodes (fix #3474)
This commit is contained in:
parent
6bdb577d4a
commit
ba5fb31188
@ -46,6 +46,7 @@ declare interface VNodeData {
|
||||
on?: ?{ [key: string]: Function | Array<Function> };
|
||||
nativeOn?: { [key: string]: Function | Array<Function> };
|
||||
transition?: Object;
|
||||
transitionInjected?: boolean;
|
||||
inlineTemplate?: {
|
||||
render: Function;
|
||||
staticRenderFns: Array<Function>;
|
||||
|
@ -94,14 +94,21 @@ export function enter (vnode: VNodeWithData) {
|
||||
|
||||
if (!vnode.data.show) {
|
||||
// remove pending leave element on enter by injecting an insert hook
|
||||
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', () => {
|
||||
const hooks = vnode.data.hook || (vnode.data.hook = {})
|
||||
hooks._transitionInsert = () => {
|
||||
const parent = el.parentNode
|
||||
const pendingNode = parent._pending && parent._pending[vnode.key]
|
||||
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
|
||||
if (pendingNode && pendingNode.tag === vnode.tag && pendingNode.elm._leaveCb) {
|
||||
pendingNode.elm._leaveCb()
|
||||
}
|
||||
enterHook && enterHook(el, cb)
|
||||
})
|
||||
}
|
||||
if (!vnode.data.transitionInjected) {
|
||||
vnode.data.transitionInjected = true
|
||||
mergeVNodeHook(hooks, 'insert', () => {
|
||||
hooks._transitionInsert()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// start enter transition
|
||||
|
Loading…
Reference in New Issue
Block a user