export default {
  install (Vue, options) {
    Vue.directive("roleBtn", {
      componentUpdated: function (el, binding) {
        let roleArr = binding.value
        let userRole = JSON.parse(localStorage.getItem("info")).role
        if (roleArr && roleArr.indexOf(userRole) !== -1) {
          return false
        } else {
          el.parentNode.removeChild(el)
        }
      },
      inserted: function (el, binding) {
        let roleArr = binding.value
        let userRole = JSON.parse(localStorage.getItem("info")).role
        if (roleArr && roleArr.indexOf(userRole) !== -1) {
          return false
        } else {
          el.parentNode.removeChild(el)
        }
      }
    })
  }
}