mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-04-06 03:57:53 +08:00
update permission.js
some包含返回true,不包含返回false,if判断中直接返回some函数结果,精简代码逻辑
This commit is contained in:
parent
fe22b3cd94
commit
e85ef78c1a
@ -13,11 +13,7 @@ export default function checkPermission(value) {
|
||||
const hasPermission = roles.some(role => {
|
||||
return permissionRoles.includes(role)
|
||||
})
|
||||
|
||||
if (!hasPermission) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return hasPermission
|
||||
} else {
|
||||
console.error(`need roles! Like v-permission="['admin','editor']"`)
|
||||
return false
|
||||
|
Loading…
x
Reference in New Issue
Block a user