路由守卫判断条件修改
continuous-integration/drone/push Build is pending Details

main
wangxiaoshuang 2026-07-15 14:49:51 +08:00
parent dce7fd9737
commit fe64feac80
1 changed files with 7 additions and 2 deletions

View File

@ -92,8 +92,13 @@ router.beforeEach(async (to, from, next) => {
await store.dispatch('user/getUserInfo')
const accessRoutes = await store.dispatch('permission/generateRoutes')
resetRouter()
router.addRoutes(accessRoutes)
next({ ...to, replace: true })
if (accessRoutes.length > 0) {
router.addRoutes(accessRoutes)
next({ ...to, replace: true })
} else {
next()
}
} catch (error) {
console.log(error)
// 删除token并进入登录页面以重新登录