diff --git a/packages/fes-plugin-access/src/runtime/core.tpl b/packages/fes-plugin-access/src/runtime/core.tpl index eac5cc69..e6204151 100644 --- a/packages/fes-plugin-access/src/runtime/core.tpl +++ b/packages/fes-plugin-access/src/runtime/core.tpl @@ -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(() => { diff --git a/packages/fes-plugin-access/types.d.ts b/packages/fes-plugin-access/types.d.ts index a1289fb7..0834e5af 100644 --- a/packages/fes-plugin-access/types.d.ts +++ b/packages/fes-plugin-access/types.d.ts @@ -3,10 +3,14 @@ import type { Ref } from 'vue'; export const access: { hasAccess: (accessId: string | number) => Promise; + hasAccessSync: (accessId: string | number) => boolean; isDataReady: () => boolean; setRole: (roleId: string | Promise) => void; + getRole: () => string; setAccess: (accessIds: Array | Promise>) => void; getAccess: () => string[]; + match: (path: string, accessIds: string[]) => boolean; + setPresetAccess: (accessId: string | string[]) => void; }; export function useAccess(accessId: string | number): Ref;