mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-03 12:38:34 +08:00
fix: 修复路由meta.auth
设置为''
/[]
时,权限判断为无权限的问题
后端返回路由数据时,auth字段通常会以空字符串或者空数组用来表示不需要权限校验
This commit is contained in:
parent
b3a590d92d
commit
6a0b659750
@ -99,11 +99,15 @@ const useMenuStore = defineStore(
|
||||
let isAuth = false
|
||||
if (menu.meta && menu.meta.auth) {
|
||||
isAuth = permissions.some((auth) => {
|
||||
return typeof menu.meta?.auth === 'string'
|
||||
? menu.meta.auth === auth
|
||||
: typeof menu.meta?.auth === 'object'
|
||||
? menu.meta.auth.includes(auth)
|
||||
: false
|
||||
if (typeof menu.meta?.auth === 'string') {
|
||||
return menu.meta.auth !== '' ? menu.meta.auth === auth : true
|
||||
}
|
||||
else if (typeof menu.meta?.auth === 'object') {
|
||||
return menu.meta.auth.length > 0 ? menu.meta.auth.includes(auth) : true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
@ -111,11 +111,15 @@ const useRouteStore = defineStore(
|
||||
let isAuth = false
|
||||
if (route.meta?.auth) {
|
||||
isAuth = permissions.some((auth) => {
|
||||
return typeof route.meta?.auth === 'string'
|
||||
? route.meta.auth === auth
|
||||
: typeof route.meta?.auth === 'object'
|
||||
? route.meta.auth.includes(auth)
|
||||
: false
|
||||
if (typeof route.meta?.auth === 'string') {
|
||||
return route.meta.auth !== '' ? route.meta.auth === auth : true
|
||||
}
|
||||
else if (typeof route.meta?.auth === 'object') {
|
||||
return route.meta.auth.length > 0 ? route.meta.auth.includes(auth) : true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user