lilishop-ui/seller/src/libs/hasRole.js

17 lines
395 B
JavaScript
Raw Normal View History

2021-05-13 10:56:04 +08:00
import { getStore } from './storage';
const hasRole = {
install (Vue, options) {
Vue.directive('hasRole', {
inserted (el, binding) {
let roles = getStore("roles");
if (roles&&!roles.includes(binding.value)) {
el.parentNode.removeChild(el);
}
}
});
}
};
export default hasRole;