import { BtnPermissionStore } from '/@/plugin/permission/store.permission';


const { data } = BtnPermissionStore();

/**
 * 判断是否有权限
 * @param permissions /api/system/menu_button/menu_button_all_permission/ 中是否包含传递进来的值
 */
export function hasPermission(permissions: string | string[]): boolean {
  if (typeof permissions === 'string') {
    return data.includes(permissions);
  } else if (Array.isArray(permissions)) {
    return permissions.every(permission => data.includes(permission));
  }
  return false;
}
