mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 06:00:33 +03:00
fix: call afterNavigation after nextTick (#478)
* fix: afterNavigation * style: use arrow function
This commit is contained in:
committed by
Pim
parent
c6b20eb1c0
commit
fa12530b3e
@@ -19,10 +19,12 @@ export function addNavGuards (rootVm) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
const { metaInfo } = resume(rootVm)
|
rootVm.$nextTick(() => {
|
||||||
|
const { metaInfo } = resume(rootVm)
|
||||||
|
|
||||||
if (metaInfo && isFunction(metaInfo.afterNavigation)) {
|
if (metaInfo && isFunction(metaInfo.afterNavigation)) {
|
||||||
metaInfo.afterNavigation(metaInfo)
|
metaInfo.afterNavigation(metaInfo)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,6 +271,8 @@ describe('components', () => {
|
|||||||
expect(wrapper.vm.$root._vueMeta.pausing).toBe(true)
|
expect(wrapper.vm.$root._vueMeta.pausing).toBe(true)
|
||||||
|
|
||||||
guards.after()
|
guards.after()
|
||||||
|
expect(afterNavigation).not.toHaveBeenCalled()
|
||||||
|
await vmTick(wrapper.vm)
|
||||||
expect(afterNavigation).toHaveBeenCalled()
|
expect(afterNavigation).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -306,6 +308,8 @@ describe('components', () => {
|
|||||||
expect(wrapper.vm.$root._vueMeta.pausing).toBe(true)
|
expect(wrapper.vm.$root._vueMeta.pausing).toBe(true)
|
||||||
|
|
||||||
guards.after()
|
guards.after()
|
||||||
|
expect(afterNavigation).not.toHaveBeenCalled()
|
||||||
|
await vmTick(wrapper.vm)
|
||||||
expect(afterNavigation).toHaveBeenCalled()
|
expect(afterNavigation).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user