vue-admin-beautiful/src/utils/permission.js

21 lines
523 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}