mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
Merge pull request #3461 from ktsn/fix-scroll-behavior
fix: ensure emit triggerScroll event after scrollBehavior is called
This commit is contained in:
commit
7c852029aa
@ -32,7 +32,10 @@ export default {
|
|||||||
// Add triggerScroll event on beforeEnter (fix #1376)
|
// Add triggerScroll event on beforeEnter (fix #1376)
|
||||||
let beforeEnter = listeners.beforeEnter
|
let beforeEnter = listeners.beforeEnter
|
||||||
listeners.beforeEnter = (el) => {
|
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)
|
if (beforeEnter) return beforeEnter.call(_parent, el)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user