调整登录逻辑退出登录调整拦截器新增路由通配404也买呢
This commit is contained in:
@@ -18,7 +18,11 @@ const router = createRouter({
|
||||
paramsToQuery: true
|
||||
},
|
||||
platform: process.env.VUE_APP_PLATFORM,
|
||||
routes: [...ROUTES]
|
||||
routes: [...ROUTES, {
|
||||
path: '*',
|
||||
name:'404',
|
||||
component: ()=> import('@/pages/404/404')
|
||||
}]
|
||||
})
|
||||
|
||||
// 全局路由前置守卫
|
||||
@@ -27,7 +31,10 @@ router.beforeEach((to, from, next) => {
|
||||
// 检查是否需要登录
|
||||
if(to.auth && token === ''){
|
||||
next({
|
||||
name: 'Login'
|
||||
name: 'Login',
|
||||
params: {
|
||||
toName: to.name
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user