zhangzengfei
2021-11-17 5186227a467bd34dc253e64b23bc96d3a07bb399
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
  }
}