fix(vue-app): always finish transition.leave asynchronously (#5891)

This commit is contained in:
Pim 2019-06-14 19:28:03 +02:00 committed by Pooya Parsa
parent 835611f78d
commit 2a2bf9b93d

View File

@ -48,21 +48,33 @@ export default {
window.<%= globals.nuxt %>.$nextTick(() => { window.<%= globals.nuxt %>.$nextTick(() => {
window.<%= globals.nuxt %>.$emit('triggerScroll') window.<%= globals.nuxt %>.$emit('triggerScroll')
}) })
if (beforeEnter) return beforeEnter.call(_parent, el) if (beforeEnter) {
return beforeEnter.call(_parent, el)
}
} }
let routerView = [ // make sure that leave is called asynchronous (fix #5703)
h('router-view', data) if (transition.css === false) {
] const leave = listeners.leave
if (props.keepAlive) { listeners.leave = (el, done) => {
routerView = [ if (leave) {
h('keep-alive', { props: props.keepAliveProps }, routerView) leave.call(_parent, el)
] }
_parent.$nextTick(done)
}
} }
let routerView = h('routerView', data)
if (props.keepAlive) {
routerView = h('keep-alive', { props: props.keepAliveProps }, [routerView])
}
return h('transition', { return h('transition', {
props: transitionProps, props: transitionProps,
on: listeners on: listeners
}, routerView) }, [routerView])
} }
} }