Commit e4d60eca authored by 李苏's avatar 李苏 💬

路由进度条

parent a7654d57
......@@ -11,14 +11,14 @@ NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => {
console.log(store.state.user.token)
NProgress.start()
// console.log(store.state.user.token)
// NProgress.start()
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
// NProgress.done()
} else {
if (store.state.app.isInit==false) {
store.commit('app/changeInit')
......@@ -40,11 +40,11 @@ router.beforeEach((to, from, next) => {
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
// NProgress.done()
}
}
})
router.afterEach(() => {
NProgress.done()
// NProgress.done()
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment