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) {
      // eslint-disable-next-line no-unused-expressions
      if (el.parentNode) {
        console.log(el);
        el.parentNode.removeChild(el);
      } else {
        el.innerHTML = "";
      }
    } else {
      el && el.setAttribute("code", value);
    }
  },
};