|
@ -11,15 +11,17 @@ function locateNode (vnode: VNode): VNodeWithData { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
bind (el: HTMLElement, { value }: VNodeDirective, vnode: VNodeWithData) { |
|
|
bind (el: any, { value }: VNodeDirective, vnode: VNodeWithData) { |
|
|
vnode = locateNode(vnode) |
|
|
vnode = locateNode(vnode) |
|
|
const transition = vnode.data && vnode.data.transition |
|
|
const transition = vnode.data && vnode.data.transition |
|
|
if (value && transition && transition.appear && !isIE9) { |
|
|
if (value && transition && transition.appear && !isIE9) { |
|
|
enter(vnode) |
|
|
enter(vnode) |
|
|
} |
|
|
} |
|
|
el.style.display = value ? '' : 'none' |
|
|
const originalDisplay = el.style.display |
|
|
|
|
|
el.style.display = value ? originalDisplay : 'none' |
|
|
|
|
|
el.__vOriginalDisplay = originalDisplay |
|
|
}, |
|
|
}, |
|
|
update (el: HTMLElement, { value, oldValue }: VNodeDirective, vnode: VNodeWithData) { |
|
|
update (el: any, { value, oldValue }: VNodeDirective, vnode: VNodeWithData) { |
|
|
/* istanbul ignore if */ |
|
|
/* istanbul ignore if */ |
|
|
if (value === oldValue) return |
|
|
if (value === oldValue) return |
|
|
vnode = locateNode(vnode) |
|
|
vnode = locateNode(vnode) |
|
@ -27,14 +29,14 @@ export default { |
|
|
if (transition && !isIE9) { |
|
|
if (transition && !isIE9) { |
|
|
if (value) { |
|
|
if (value) { |
|
|
enter(vnode) |
|
|
enter(vnode) |
|
|
el.style.display = '' |
|
|
el.style.display = el.__vOriginalDisplay |
|
|
} else { |
|
|
} else { |
|
|
leave(vnode, () => { |
|
|
leave(vnode, () => { |
|
|
el.style.display = 'none' |
|
|
el.style.display = 'none' |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
el.style.display = value ? '' : 'none' |
|
|
el.style.display = value ? el.__vOriginalDisplay : 'none' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|