fix weird bug by updating routerKey on router "afterEach" hook

This commit is contained in:
axolotle 2022-02-07 04:42:03 +01:00
parent fa63687cd6
commit 19d8ebb4a6

View file

@ -28,8 +28,6 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
store.dispatch('UPDATE_ROUTER_KEY', { to, from })
store.dispatch('UPDATE_BREADCRUMB', { to, from })
if (store.getters.transitions && from.name !== null) { if (store.getters.transitions && from.name !== null) {
store.dispatch('UPDATE_TRANSITION_NAME', { to, from }) store.dispatch('UPDATE_TRANSITION_NAME', { to, from })
} }
@ -45,4 +43,9 @@ router.beforeEach((to, from, next) => {
} }
}) })
router.afterEach((to, from) => {
store.dispatch('UPDATE_ROUTER_KEY', { to, from })
store.dispatch('UPDATE_BREADCRUMB', { to, from })
})
export default router export default router