fix: 修复 ts 类型声明问题

This commit is contained in:
winixt 2023-02-27 14:29:37 +08:00
parent 95ba5e5592
commit 6f914a755e
2 changed files with 25 additions and 21 deletions

View File

@ -11,6 +11,28 @@ interface Menu {
} }
export const Page: Component; 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[]> | 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' { declare module '@fesjs/fes' {
interface RouteMeta { interface RouteMeta {
'keep-alive'?: boolean; 'keep-alive'?: boolean;
@ -40,25 +62,6 @@ declare module '@fesjs/fes' {
| false; | false;
} }
interface PluginRuntimeConfig { interface PluginRuntimeConfig {
layout?: { layout?: LayoutRuntimeConfig | ((layoutRuntimeConfig: LayoutRuntimeConfig, { initialState }: { initialState: any }) => 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[]> | Menu[]);
menuProps?: {
expandedKeys?: string[];
defaultExpandAll?: boolean;
accordion?: boolean;
};
renderCustom?: () => VNode | VNode[];
noFoundHandler?: (param: { router: Router } & NavigationGuard) => void;
unAccessHandler?: (param: { router: Router } & NavigationGuard) => void;
};
} }
} }

View File

@ -21,6 +21,7 @@ type RenderFunc = () => Promise<App>;
interface Route { interface Route {
base: string; base: string;
mode: string; mode: string;
routes: RouteRecordRaw[];
createHistory: createMemoryHistory | createWebHashHistory | createWebHistory; createHistory: createMemoryHistory | createWebHashHistory | createWebHistory;
} }
@ -32,7 +33,7 @@ declare module '@fesjs/fes' {
interface PluginRuntimeConfig { interface PluginRuntimeConfig {
beforeRender?: BeforeRenderConfig; beforeRender?: BeforeRenderConfig;
patchRoutes?: ({ routes }: { routes: RouteRecordRaw[] }) => void; patchRoutes?: ({ routes }: { routes: RouteRecordRaw[] }) => void;
modifyRoute?: ({ base, mode, createHistory }: Route) => Route; modifyRoute?: ({ base, mode, routes, createHistory }: Route) => Route;
modifyClientRenderOpts?: (option: ClientRenderOption) => ClientRenderOption; modifyClientRenderOpts?: (option: ClientRenderOption) => ClientRenderOption;
rootContainer?: (component: DefineComponent, option: { routes: RouteRecordRaw[]; plugin: Plugin }) => Component; rootContainer?: (component: DefineComponent, option: { routes: RouteRecordRaw[]; plugin: Plugin }) => Component;
onAppCreated?: ({ app, routes }: { app: App; routes: RouteRecordRaw[] }) => void; onAppCreated?: ({ app, routes }: { app: App; routes: RouteRecordRaw[] }) => void;