wang-hao-jie
2021-11-01 c73d38d71545cea55f5ce0f5a95cb2b3e199a6e6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;