Skip to content
On this page

权限

按钮权限

通过自定义指令v-permission实现权限判断

vue
<n-button
	v-permission="{ permission: ['app:module:delete'] }"
	type="error"
	@click="moduleProxy.handleDelete(null)"
>
	批量删除
</n-button>

v-permission 参数说明

ts
interface Permission {
	"role": string[] | number[],
	"permission ": string[],
	"mode": "oneOf" | "allOf" | "except"
	// 参数说明
	// allOf: 数组内所有角色都拥有,返回True;
	// oneOf: 数组内拥有任一角色,返回True(等价第1种数据)
	// except: 不拥有数组内任一角色,返回True(取反)
}