refactor: 更多操作权限样式

This commit is contained in:
chenjianxing 2021-07-12 17:48:40 +08:00 committed by jianxing
parent 7c38db9ad3
commit db3a0a2e8a
1 changed files with 5 additions and 1 deletions

View File

@ -8,7 +8,7 @@
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, index) in commands" :key="index" @click.native.stop="click(item)" <el-dropdown-item v-for="(item, index) in commands" :key="index" @click.native.stop="click(item)"
v-permission="item.permissions" :disabled="disabled(item.permissions)"
> >
<span class="tip-font" v-if="!item.children"> <span class="tip-font" v-if="!item.children">
{{ item.label }} {{ item.label }}
@ -39,6 +39,7 @@
<script> <script>
import moduleTrashButton from "@/business/components/api/definition/components/module/ModuleTrashButton"; import moduleTrashButton from "@/business/components/api/definition/components/module/ModuleTrashButton";
import {hasPermissions} from "@/common/js/utils";
export default { export default {
components:{moduleTrashButton}, components:{moduleTrashButton},
@ -69,6 +70,9 @@ export default {
item.callback(); item.callback();
} }
}, },
disabled(permissions) {
return !hasPermissions(...permissions);
}
} }
} }
</script> </script>