Skip to content

Commit

Permalink
fix(vue-app): always finish transition.leave asynchronously (#5891)
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie authored and pi0 committed Aug 20, 2019
1 parent 7433c6d commit fdbea52
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions packages/vue-app/template/components/nuxt-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,33 @@ export default {
window.<%= globals.nuxt %>.$nextTick(() => {
window.<%= globals.nuxt %>.$emit('triggerScroll')
})
if (beforeEnter) return beforeEnter.call(_parent, el)
if (beforeEnter) {
return beforeEnter.call(_parent, el)
}
}

let routerView = [
h('router-view', data)
]
// make sure that leave is called asynchronous (fix #5703)
if (transition.css === false) {
const leave = listeners.leave
listeners.leave = (el, done) => {
if (leave) {
leave.call(_parent, el)
}

_parent.$nextTick(done)
}
}

let routerView = h('routerView', data)

if (props.keepAlive) {
routerView = [
h('keep-alive', { props: props.keepAliveProps }, routerView)
]
routerView = h('keep-alive', { props: props.keepAliveProps }, [routerView])
}

return h('transition', {
props: transitionProps,
on: listeners
}, routerView)
}, [routerView])
}
}

Expand Down

0 comments on commit fdbea52

Please sign in to comment.