directives/index.js
自定义指令:
// 按钮权限控制
showButton: {
inserted(dom, obj) {
if (!store.state.user.userInfo.roles.points.includes(obj.value)) {
dom.style.display = 'none'
}
},
componentUpdated(dom, obj) {
if (!store.state.user.userInfo.roles.points.includes(obj.value)) {
dom.style.display = 'none'
}
}
}
xxx.vue
//按钮
v-showButton="employees_del_button"
标签:style,obj,dom,state,按钮,权限
From: https://www.cnblogs.com/strundent/p/16882788.html