cmc-web/packages/common/directive/index.js

16 lines
424 B
JavaScript
Raw Normal View History

2024-08-20 12:11:31 +00:00
/**
* Created by Zhang Haijun on 2018/1/25.
*/
/* global $ */
import Vue from 'vue'
import store from '@cmp/cmp-core/store'
export const permission = Vue.directive('permission', function (el, binding) {
const buttons = store.state.permission.buttons
if (!buttons.includes(binding.value)) {
// el.parentNode && el.parentNode.removeChild(el)
el.style.display = 'none'
} else {
el.style.display = ''
}
})