mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +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.setRole('admin');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### access.getRole
|
||||||
|
|
||||||
|
- **类型**:函数
|
||||||
|
- **详情**:获取当前的角色。
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { access } from '@fesjs/fes';
|
||||||
|
access.getRole();
|
||||||
|
```
|
||||||
|
|
||||||
#### access.setAccess
|
#### access.setAccess
|
||||||
|
|
||||||
- **类型**:函数
|
- **类型**:函数
|
||||||
|
@ -138,6 +138,9 @@ export const access = {
|
|||||||
hasAccess,
|
hasAccess,
|
||||||
isDataReady,
|
isDataReady,
|
||||||
setRole,
|
setRole,
|
||||||
|
getRole: () => {
|
||||||
|
return state.currentRoleId
|
||||||
|
},
|
||||||
setAccess,
|
setAccess,
|
||||||
match,
|
match,
|
||||||
getAccess: getAllowAccessIds,
|
getAccess: getAllowAccessIds,
|
||||||
|
@ -6,13 +6,14 @@ import UserCenter from '@/components/userCenter.vue';
|
|||||||
export const beforeRender = {
|
export const beforeRender = {
|
||||||
loading: <PageLoading />,
|
loading: <PageLoading />,
|
||||||
action() {
|
action() {
|
||||||
const { setRole } = accessApi;
|
const { setRole, getRole } = accessApi;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setRole('admin');
|
setRole('admin');
|
||||||
resolve({
|
resolve({
|
||||||
userName: '李雷',
|
userName: '李雷',
|
||||||
});
|
});
|
||||||
|
console.log('currentRole', getRole());
|
||||||
createWatermark({ content: '万纯(harrywan)' });
|
createWatermark({ content: '万纯(harrywan)' });
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user