Merge pull request #3461 from ktsn/fix-scroll-behavior

fix: ensure emit triggerScroll event after scrollBehavior is called
This commit is contained in:
HG 2018-07-12 14:24:13 +01:00 committed by GitHub
commit 7c852029aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,10 @@ export default {
// Add triggerScroll event on beforeEnter (fix #1376)
let beforeEnter = listeners.beforeEnter
listeners.beforeEnter = (el) => {
window.$nuxt.$emit('triggerScroll')
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
if (beforeEnter) return beforeEnter.call(_parent, el)
}