Some checks failed
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
14 lines
414 B
Vue
14 lines
414 B
Vue
import store from '@/store'
|
|
|
|
export default {
|
|
inserted(element, binding) {
|
|
const { value } = binding
|
|
const permissions = store.getters['user/permissions']
|
|
if (value && value instanceof Array && value.length > 0) {
|
|
const hasPermission = permissions.some((role) => value.includes(role))
|
|
if (!hasPermission)
|
|
element.parentNode && element.parentNode.removeChild(element)
|
|
}
|
|
},
|
|
}
|