zhangzengfei
2021-09-07 1cb263efda55e67a8d5066edd7709b056f9b85ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
  }
}