mirror of
https://gitee.com/chu1204505056/vue-admin-beautiful.git
synced 2025-04-06 03:58:00 +08:00
21 lines
523 B
JavaScript
21 lines
523 B
JavaScript
import store from "@/store";
|
||
|
||
/**
|
||
* @author chuzhixin 1204505056@qq.com (不想保留author可删除)
|
||
* @description 检查权限
|
||
* @param value
|
||
* @returns {boolean}
|
||
*/
|
||
export default function checkPermission(value) {
|
||
if (value && value instanceof Array && value.length > 0) {
|
||
const permissions = store.getters["user/permissions"];
|
||
const permissionPermissions = value;
|
||
|
||
return permissions.some((role) => {
|
||
return permissionPermissions.includes(role);
|
||
});
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|