- [Vuejs]-What nginx server config exactly should be for Nuxt.js Universal project?
- [Vuejs]-Access vuex state in separate axios template js file
0👍
Personally for these cases I use an afterEach
hook in the routes file:
router.afterEach((to, from) => {
let exist = false
for (let i in this.a.options.routes) {
if (this.a.options.routes[i].name === to.name) {
exist = true
}
}
if (!exist) {
this.a.push({
name: from.name
})
}
})
You can use another hook as beforeEach
(I do not remember exactly why we use after). Basically the goal is to go through the list of routes, if it does not exist, it returns you to the route you are currently on, which really means that you do not notice any changes, it just does not change the route.
Source:stackexchange.com