import store from '@/store'

export default {
  inserted (el, binding, vnode) {
    const { value } = binding
    const permissions = store.getters.pageRoleArray || []
    // console.log('permissionList---', permissions)
    const hasPermission = permissions.includes(value)
    if (!hasPermission) {
      if (el.parentNode) {
        el.parentNode.removeChild(el)
      } else {
        el.innerHTML = ''
      }
    } else {
      el && el.setAttribute('code', value)
    }
  },
}
