hasPermi.js 367 B

123456789101112131415161718
  1. /**
  2. * 操作权限处理
  3. * Copyright (c) 2019 ruoyi
  4. */
  5. import store from '@/store'
  6. export default {
  7. inserted(el, binding, vnode) {
  8. const { value } = binding
  9. const func = store.getters && store.getters.hasPermissions
  10. const hasPermissions = func(value)
  11. if (!hasPermissions) {
  12. el.parentNode && el.parentNode.removeChild(el)
  13. }
  14. }
  15. }