1
0
mirror of https://github.com/WeBankFinTech/fes.js.git synced 2025-04-06 03:59:53 +08:00

feat: plugin access 添加 getRole 接口 ()

This commit is contained in:
qlin 2023-08-23 19:11:08 +08:00 committed by GitHub
parent 205d19efa8
commit 18bd63a539
3 changed files with 15 additions and 1 deletions
docs/reference/plugin/plugins
packages
fes-plugin-access/src/runtime
fes-template/src

@ -227,6 +227,16 @@ import { access } from '@fesjs/fes';
access.setRole('admin');
```
#### access.getRole
- **类型**:函数
- **详情**:获取当前的角色。
```js
import { access } from '@fesjs/fes';
access.getRole();
```
#### access.setAccess
- **类型**:函数

@ -138,6 +138,9 @@ export const access = {
hasAccess,
isDataReady,
setRole,
getRole: () => {
return state.currentRoleId
},
setAccess,
match,
getAccess: getAllowAccessIds,

@ -6,13 +6,14 @@ import UserCenter from '@/components/userCenter.vue';
export const beforeRender = {
loading: <PageLoading />,
action() {
const { setRole } = accessApi;
const { setRole, getRole } = accessApi;
return new Promise((resolve) => {
setTimeout(() => {
setRole('admin');
resolve({
userName: '李雷',
});
console.log('currentRole', getRole());
createWatermark({ content: '万纯(harrywan)' });
}, 1000);
});