From 6f914a755e16b917fa2eebbe6a70988ea5d9f7f4 Mon Sep 17 00:00:00 2001 From: winixt Date: Mon, 27 Feb 2023 14:29:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20ts=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=A3=B0=E6=98=8E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-layout/types.d.ts | 43 +++++++++++++------------ packages/fes-preset-built-in/types.d.ts | 3 +- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/packages/fes-plugin-layout/types.d.ts b/packages/fes-plugin-layout/types.d.ts index c88eefa25..0c3a53219 100644 --- a/packages/fes-plugin-layout/types.d.ts +++ b/packages/fes-plugin-layout/types.d.ts @@ -11,6 +11,28 @@ interface Menu { } export const Page: Component; + +interface LayoutRuntimeConfig { + footer?: string; + theme?: 'dark' | 'light'; + navigation?: 'side' | 'top' | 'mixin' | 'left-right'; + title?: string; + isFixedHeader?: boolean; + isFixedSidebar?: boolean; + logo?: string; + multiTabs?: boolean; + sideWidth?: number; + menus?: Menu[] | (() => Ref | Menu[]); + menuProps?: { + expandedKeys?: string[]; + defaultExpandAll?: boolean; + accordion?: boolean; + }; + renderCustom?: () => VNode | VNode[]; + noFoundHandler?: (param: { router: Router } & NavigationGuard) => void; + unAccessHandler?: (param: { router: Router } & NavigationGuard) => void; +} + declare module '@fesjs/fes' { interface RouteMeta { 'keep-alive'?: boolean; @@ -40,25 +62,6 @@ declare module '@fesjs/fes' { | false; } interface PluginRuntimeConfig { - layout?: { - footer?: string; - theme?: 'dark' | 'light'; - navigation?: 'side' | 'top' | 'mixin' | 'left-right'; - title?: string; - isFixedHeader?: boolean; - isFixedSidebar?: boolean; - logo?: string; - multiTabs?: boolean; - sideWidth?: number; - menus?: Menu[] | (() => Ref | Menu[]); - menuProps?: { - expandedKeys?: string[]; - defaultExpandAll?: boolean; - accordion?: boolean; - }; - renderCustom?: () => VNode | VNode[]; - noFoundHandler?: (param: { router: Router } & NavigationGuard) => void; - unAccessHandler?: (param: { router: Router } & NavigationGuard) => void; - }; + layout?: LayoutRuntimeConfig | ((layoutRuntimeConfig: LayoutRuntimeConfig, { initialState }: { initialState: any }) => LayoutRuntimeConfig); } } diff --git a/packages/fes-preset-built-in/types.d.ts b/packages/fes-preset-built-in/types.d.ts index 4b4b449c0..8a241e72e 100644 --- a/packages/fes-preset-built-in/types.d.ts +++ b/packages/fes-preset-built-in/types.d.ts @@ -21,6 +21,7 @@ type RenderFunc = () => Promise; interface Route { base: string; mode: string; + routes: RouteRecordRaw[]; createHistory: createMemoryHistory | createWebHashHistory | createWebHistory; } @@ -32,7 +33,7 @@ declare module '@fesjs/fes' { interface PluginRuntimeConfig { beforeRender?: BeforeRenderConfig; patchRoutes?: ({ routes }: { routes: RouteRecordRaw[] }) => void; - modifyRoute?: ({ base, mode, createHistory }: Route) => Route; + modifyRoute?: ({ base, mode, routes, createHistory }: Route) => Route; modifyClientRenderOpts?: (option: ClientRenderOption) => ClientRenderOption; rootContainer?: (component: DefineComponent, option: { routes: RouteRecordRaw[]; plugin: Plugin }) => Component; onAppCreated?: ({ app, routes }: { app: App; routes: RouteRecordRaw[] }) => void;