Skip to content

Commit e85ef78

Browse files
authored
update permission.js
some包含返回true,不包含返回false,if判断中直接返回some函数结果,精简代码逻辑
1 parent fe22b3c commit e85ef78

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/utils/permission.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ export default function checkPermission(value) {
1313
const hasPermission = roles.some(role => {
1414
return permissionRoles.includes(role)
1515
})
16-
17-
if (!hasPermission) {
18-
return false
19-
}
20-
return true
16+
return hasPermission
2117
} else {
2218
console.error(`need roles! Like v-permission="['admin','editor']"`)
2319
return false

0 commit comments

Comments
 (0)