import { useUserStore } from '@/store';
const perm = (el, binding) => {
  const userStore = useUserStore();
  const { value } = binding;
  if (!!value) {
    const keys = value.split(',');
    if (keys.every((key) => !userStore.finePermissionIds.includes(key))) {
      // el.parentNode && el.parentNode.removeChild(el);
      el.remove();
    }
  } else {
    throw new Error(`请设置操作权限标签值`);
  }
};

export default {
  mounted(el, binding) {
    perm(el, binding);
  },
  updated(el, binding) {
    perm(el, binding);
  },
};
