src\store\modules\permission.ts
actions: {
async setPermCodeList(codeList: string[]) {
if (codeList == null || codeList.length < 1) {//这里增加不为空判断
this.permCodeList = await getPermCode();
return;
}
this.permCodeList = codeList;
},
async changePermissionCode() {
const systemPermission = await getPermCode();
//const codeList = systemPermission.codeList//原句这里有错误!!!!!!!!!!!!
this.setPermCodeList(systemPermission);
//this.setPermCodeList(codeList);
this.setAuthData(systemPermission);
},
页面模板中使用方法:判断是否显示按钮
i
mport { usePermission } from '/@/hooks/web/usePermission'
const { hasPermission } = usePermission();
<a-button type="primary" preIcon="ant-design:plus-outlined"
v-if="hasPermission('user:add')" @click="handleCreate" >a新增</a-button>
原来的标签用法
v-auth=“‘user:add’” 用法?????????????
<template #action="{ record }"> //record表格行记录
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
//单元格操作 单元格下拉框操作
</template>