0👍
Isn’t simple to answer without see code in action, but, you can try to invert call to this.nprogess.done()
and next(...)
like this:
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth) {
const authUser = JSON.parse(window.localStorage.getItem('authUser'))
if (authUser && authUser.auth) {
next()
} else {
this.nprogress.done(); // <- HERE
next({name: 'login'})
}
}
next()
}
since next() call move context to new component, and I’m not sure call to nprogress will be called on the right moment.
- [Vuejs]-How can i use computed property in v-for
- [Vuejs]-"Not allowed to load local resource" Electron/VUE
Source:stackexchange.com