2020-09-28 20:19:10 +08:00
|
|
|
import type { RouteRecordRaw } from 'vue-router';
|
|
|
|
|
import { RoleEnum } from '/@/enums/roleEnum';
|
2020-12-03 21:49:32 +08:00
|
|
|
import Component from '/@/components/types';
|
2020-09-28 20:19:10 +08:00
|
|
|
export interface RouteMeta {
|
|
|
|
|
// title
|
|
|
|
|
title: string;
|
|
|
|
|
// Whether to ignore permissions
|
|
|
|
|
ignoreAuth?: boolean;
|
|
|
|
|
// role info
|
|
|
|
|
roles?: RoleEnum[];
|
|
|
|
|
// Whether not to cache
|
|
|
|
|
ignoreKeepAlive?: boolean;
|
|
|
|
|
// Is it fixed on tab
|
|
|
|
|
affix?: boolean;
|
|
|
|
|
// icon on tab
|
|
|
|
|
icon?: string;
|
2020-12-21 22:20:01 +08:00
|
|
|
|
|
|
|
|
frameSrc?: string;
|
2020-09-28 20:19:10 +08:00
|
|
|
|
|
|
|
|
// current page transition
|
|
|
|
|
transitionName?: string;
|
|
|
|
|
|
|
|
|
|
// Whether the route has been dynamically added
|
|
|
|
|
hideBreadcrumb?: boolean;
|
|
|
|
|
|
2020-10-14 22:08:56 +08:00
|
|
|
// Carrying parameters
|
|
|
|
|
carryParam?: boolean;
|
2020-12-03 21:49:32 +08:00
|
|
|
|
2020-12-07 23:56:57 +08:00
|
|
|
// Used internally to mark single-level menus
|
2020-12-03 21:49:32 +08:00
|
|
|
single?: boolean;
|
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-03 21:49:32 +08:00
|
|
|
component?: Component;
|
|
|
|
|
components?: Component;
|
2020-09-28 20:19:10 +08:00
|
|
|
children?: AppRouteRecordRaw[];
|
2020-12-03 21:49:32 +08:00
|
|
|
props?: Record<string, any>;
|
2020-10-14 21:08:07 +08:00
|
|
|
fullPath?: string;
|
2020-09-28 20:19:10 +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;
|
|
|
|
|
|
|
|
|
|
path: string;
|
|
|
|
|
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
|
|
|
|
|
children?: Menu[];
|
|
|
|
|
|
|
|
|
|
orderNo?: number;
|
|
|
|
|
|
|
|
|
|
roles?: RoleEnum[];
|
|
|
|
|
|
|
|
|
|
meta?: Partial<RouteMeta>;
|
2020-11-10 23:16:42 +08:00
|
|
|
|
|
|
|
|
tag?: MenuTag;
|
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
|
|
|
// interface RouteModule {
|
|
|
|
|
// layout: AppRouteRecordRaw;
|
|
|
|
|
// routes: AppRouteRecordRaw[];
|
|
|
|
|
// children?: AppRouteRecordRaw[];
|
|
|
|
|
// component?: Component;
|
|
|
|
|
// }
|
2020-11-12 22:20:15 +08:00
|
|
|
|
2020-12-03 21:49:32 +08:00
|
|
|
// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
|
|
|
|
|
export type AppRouteModule = AppRouteRecordRaw;
|