Skip to content

Commit

Permalink
perf: 指令权限v-auth支持并显示按钮权限 (#3035)
Browse files Browse the repository at this point in the history
  • Loading branch information
luchanan committed Sep 17, 2023
1 parent d3fd22d commit 99ddc35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hooks/web/usePermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export function usePermission() {
if (PermissionModeEnum.BACK === permMode) {
const allCodeList = permissionStore.getPermCodeList as string[];
if (!isArray(value)) {
const splits = ['||', '&&'];
const splitName = splits.find((item) => value.includes(item));
if (splitName) {
const splitCodes = value.split(splitName);
return splitName === splits[0]
? intersection(splitCodes, allCodeList).length > 0
: intersection(splitCodes, allCodeList).length === splitCodes.length;
}
return allCodeList.includes(value);
}
return (intersection(value, allCodeList) as string[]).length > 0;
Expand Down

0 comments on commit 99ddc35

Please sign in to comment.