mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-21 11:29:20 +08:00
fix: 修复禁用动态路由后用户名不显示的问题
This commit is contained in:
parent
02dca40083
commit
0f1afe1a94
@ -45,15 +45,14 @@ router.beforeEach(async (to, _from, next) => {
|
||||
|
||||
// 否则要重新获取权限角色
|
||||
try {
|
||||
await userStore.getInfo()
|
||||
if (routeSettings.async) {
|
||||
// 注意:角色必须是一个数组! 例如: ['admin'] 或 ['developer', 'editor']
|
||||
await userStore.getInfo()
|
||||
const roles = userStore.roles
|
||||
// 根据角色生成可访问的 Routes(可访问路由 = 常驻路由 + 有访问权限的动态路由)
|
||||
permissionStore.setRoutes(roles)
|
||||
} else {
|
||||
// 没有开启动态路由功能,则启用默认角色
|
||||
userStore.setRoles(routeSettings.defaultRoles)
|
||||
// 没有开启动态路由功能,则启用默认角色来生成
|
||||
permissionStore.setRoutes(routeSettings.defaultRoles)
|
||||
}
|
||||
// 将'有访问权限的动态路由' 添加到 Router 中
|
||||
|
Loading…
x
Reference in New Issue
Block a user