后台管理 登陆权限问题解决
This commit is contained in:
@@ -15,11 +15,13 @@ app.use(router);
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component);
|
||||
}
|
||||
|
||||
// 自定义权限指令
|
||||
const permiss = usePermissStore();
|
||||
app.directive('permiss', {
|
||||
app.directive('permiss', { // 元素级权限控制
|
||||
mounted(el, binding) {
|
||||
if (!permiss.key.includes(String(binding.value))) {
|
||||
const role = localStorage.getItem('ms_role_id');
|
||||
if (!permiss[role as string] || !permiss[role as string].includes(binding.value as string)) {
|
||||
el['hidden'] = true;
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user