Compare commits

...

2 Commits

Author SHA1 Message Date
wangxiaoshuang b568b40f95 Merge branch 'main' into rj 2026-07-15 14:50:08 +08:00
wangxiaoshuang fe64feac80 路由守卫判断条件修改
continuous-integration/drone/push Build was killed Details
2026-07-15 14:49:51 +08:00
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并进入登录页面以重新登录