mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 03:05:07 +08:00
feat: plugin access 添加 getRole 接口 (#207)
This commit is contained in:
parent
862b229158
commit
fdaf1fde73
@ -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);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user