|
@ -1,10 +1,10 @@ |
|
|
// 权限按钮展示指令
|
|
|
// 权限按钮展示指令
|
|
|
import { store } from '@/store/index' |
|
|
import { store } from '@/store/index' |
|
|
const userInfo = store.getters['user/userInfo'] |
|
|
|
|
|
export const auth = (Vue) => { |
|
|
export const auth = (Vue) => { |
|
|
Vue.directive('auth', { |
|
|
Vue.directive('auth', { |
|
|
// 当被绑定的元素插入到 DOM 中时……
|
|
|
// 当被绑定的元素插入到 DOM 中时……
|
|
|
bind: function (el, binding) { |
|
|
bind: function (el, binding) { |
|
|
|
|
|
const userInfo = store.getters['user/userInfo'] |
|
|
let type = "" |
|
|
let type = "" |
|
|
switch (Object.prototype.toString.call(binding.value)) { |
|
|
switch (Object.prototype.toString.call(binding.value)) { |
|
|
case "[object Array]": |
|
|
case "[object Array]": |
|
@ -27,7 +27,6 @@ export const auth = (Vue) => { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
const waitUse = binding.value.toString().split(",") |
|
|
const waitUse = binding.value.toString().split(",") |
|
|
|
|
|
|
|
|
let flag = waitUse.some(item=>item==userInfo.authorityId) |
|
|
let flag = waitUse.some(item=>item==userInfo.authorityId) |
|
|
if (binding.modifiers.not) { |
|
|
if (binding.modifiers.not) { |
|
|
flag = !flag |
|
|
flag = !flag |
|
|