Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6e07e3d3204c5816c670139660f7476d21563310.svn-base 583B

пре 5 месеци
123456789101112131415161718192021
  1. import store from '@/store'
  2. export default {
  3. inserted(el, binding) {
  4. const { value } = binding
  5. const roles = store.getters && store.getters.roles
  6. if (value && value instanceof Array) {
  7. if (value.length > 0) {
  8. const permissionRoles = value
  9. const hasPermission = roles.some(role => {
  10. return permissionRoles.includes(role)
  11. })
  12. if (!hasPermission) {
  13. el.parentNode && el.parentNode.removeChild(el)
  14. }
  15. }
  16. } else {
  17. throw new Error(`使用方式: v-permission="['admin','editor']"`)
  18. }
  19. }
  20. }