Compare commits

...

2 Commits

Author SHA1 Message Date
harrywan
6dc7114eea chore: v3.1.12 2024-05-30 15:40:44 +08:00
harrywan
56f6120f88 feat: plugin-access中导出hasAccessSync方法 2024-05-30 15:39:53 +08:00
5 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,12 @@
## [3.1.12](https://github.com/WeBankFinTech/fes.js/compare/v3.1.11...v3.1.12) (2024-05-30)
### Features
* plugin-access中导出hasAccessSync方法 ([56f6120](https://github.com/WeBankFinTech/fes.js/commit/56f6120f889a88b37760db029faa597597572831))
## [3.1.11](https://ssh.github.com:443/WeBankFinTech/fes.js/compare/v3.1.10...v3.1.11) (2024-05-24)

View File

@ -1,7 +1,7 @@
{
"name": "fes.js",
"type": "module",
"version": "3.1.11",
"version": "3.1.12",
"private": true,
"description": "一个好用的前端管理台快速开发框架",
"preferGlobal": true,

View File

@ -1,6 +1,6 @@
{
"name": "@fesjs/plugin-access",
"version": "3.1.5",
"version": "3.1.6",
"description": "@fesjs/plugin-access",
"main": "lib/index.js",
"files": [

View File

@ -145,8 +145,13 @@ export const install = (app) => {
app.component("Access", createComponent(useAccess));
};
export const hasAccessSync = (path) => {
return match(unref(path), getAllowAccessIds());
}
export const access = {
hasAccess,
hasAccessSync,
isDataReady,
setRole,
getRole: () => {
@ -158,10 +163,6 @@ export const access = {
setPresetAccess,
};
export const hasAccessSync = (path) => {
return match(unref(path), getAllowAccessIds());
}
export const useAccess = (path) => {
const allowPageIds = computed(getAllowAccessIds);
const result = computed(() => {

View File

@ -3,10 +3,14 @@ import type { Ref } from 'vue';
export const access: {
hasAccess: (accessId: string | number) => Promise<boolean>;
hasAccessSync: (accessId: string | number) => boolean;
isDataReady: () => boolean;
setRole: (roleId: string | Promise<string>) => void;
getRole: () => string;
setAccess: (accessIds: Array<string | number> | Promise<Array<string | number>>) => void;
getAccess: () => string[];
match: (path: string, accessIds: string[]) => boolean;
setPresetAccess: (accessId: string | string[]) => void;
};
export function useAccess(accessId: string | number): Ref<boolean>;