2021-06-19 22:38:29 +08:00
|
|
|
import type { RouteRecordRaw, RouteMeta } from 'vue-router';
|
2020-09-28 20:19:10 +08:00
|
|
|
import { RoleEnum } from '/@/enums/roleEnum';
|
2021-02-22 00:01:03 +08:00
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
|
|
2021-10-25 23:49:03 +08:00
|
|
|
export type Component<T = any> =
|
2021-02-22 00:01:03 +08:00
|
|
|
| ReturnType<typeof defineComponent>
|
|
|
|
|
| (() => Promise<typeof import('*.vue')>)
|
|
|
|
|
| (() => Promise<T>);
|
2020-12-23 21:51:22 +08:00
|
|
|
|
|
|
|
|
// @ts-ignore
|
2020-09-28 20:19:10 +08:00
|
|
|
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
|
2020-11-12 23:15:11 +08:00
|
|
|
name: string;
|
2020-09-28 20:19:10 +08:00
|
|
|
meta: RouteMeta;
|
2020-12-24 22:02:24 +08:00
|
|
|
component?: Component | string;
|
2020-12-03 21:49:32 +08:00
|
|
|
components?: Component;
|
2020-09-28 20:19:10 +08:00
|
|
|
children?: AppRouteRecordRaw[];
|
2020-12-25 01:09:44 +08:00
|
|
|
props?: Recordable;
|
2020-10-14 21:08:07 +08:00
|
|
|
fullPath?: string;
|
2020-09-28 20:19:10 +08:00
|
|
|
}
|
2021-06-19 22:38:29 +08:00
|
|
|
|
2020-11-10 23:16:42 +08:00
|
|
|
export interface MenuTag {
|
|
|
|
|
type?: 'primary' | 'error' | 'warn' | 'success';
|
|
|
|
|
content?: string;
|
|
|
|
|
dot?: boolean;
|
|
|
|
|
}
|
2020-09-28 20:19:10 +08:00
|
|
|
|
|
|
|
|
export interface Menu {
|
|
|
|
|
name: string;
|
|
|
|
|
|
|
|
|
|
icon?: string;
|
|
|
|
|
|
2023-10-17 12:28:15 +08:00
|
|
|
img?: string;
|
|
|
|
|
|
2020-09-28 20:19:10 +08:00
|
|
|
path: string;
|
|
|
|
|
|
2021-07-03 17:13:59 +08:00
|
|
|
// path contains param, auto assignment.
|
|
|
|
|
paramPath?: string;
|
|
|
|
|
|
2020-09-28 20:19:10 +08:00
|
|
|
disabled?: boolean;
|
|
|
|
|
|
|
|
|
|
children?: Menu[];
|
|
|
|
|
|
|
|
|
|
orderNo?: number;
|
|
|
|
|
|
|
|
|
|
roles?: RoleEnum[];
|
|
|
|
|
|
|
|
|
|
meta?: Partial<RouteMeta>;
|
2020-11-10 23:16:42 +08:00
|
|
|
|
|
|
|
|
tag?: MenuTag;
|
2021-01-17 23:02:13 +08:00
|
|
|
|
|
|
|
|
hideMenu?: boolean;
|
2020-09-28 20:19:10 +08:00
|
|
|
}
|
2020-11-21 22:47:10 +08:00
|
|
|
|
2020-09-28 20:19:10 +08:00
|
|
|
export interface MenuModule {
|
|
|
|
|
orderNo?: number;
|
|
|
|
|
menu: Menu;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-03 21:49:32 +08:00
|
|
|
// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
|
|
|
|
|
export type AppRouteModule = AppRouteRecordRaw;
|