/**
 * hasPermiDom 方法 操作权限验证
 * Copyright (c) 2022 ded
 */

import store from '@/store'
export default {
  hasPermiDom(binding) {
    const value  = binding;
    const all_permission = "*:*:*";
    const permissions = store.getters && store.getters.permissions
    if (value && value instanceof Array && value.length > 0) {
      const permissionFlag = value
      const hasPermissions = permissions.some(permission => {
        return all_permission === permission || permissionFlag.includes(permission)
      })
      return hasPermissions;
    } else {
      return false;
    }
  }
}
