1
2
import type { RouteRecordRaw } from 'vue-router';
import { RoleEnum } from '/@/enums/roleEnum';
vben
authored
5 years ago
3
vben
authored
4 years ago
4
5
6
7
8
9
import { defineComponent } from 'vue';
export type Component<T extends any = any> =
| ReturnType<typeof defineComponent>
| (() => Promise<typeof import('*.vue')>)
| (() => Promise<T>);
vben
authored
5 years ago
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
vben
authored
5 years ago
24
25
frameSrc?: string;
26
27
28
29
30
31
32
// current page transition
transitionName?: string;
// Whether the route has been dynamically added
hideBreadcrumb?: boolean;
Vben
authored
4 years ago
33
34
35
// Hide submenu
hideChildrenInMenu?: boolean;
vben
authored
5 years ago
36
37
// Carrying parameters
carryParam?: boolean;
vben
authored
5 years ago
38
vben
authored
5 years ago
39
// Used internally to mark single-level menus
vben
authored
5 years ago
40
single?: boolean;
vben
authored
5 years ago
41
42
43
44
45
46
47
48
49
// Currently active menu
currentActiveMenu?: string;
// Never show in tab
hideTab?: boolean;
// Never show in menu
hideMenu?: boolean;
Vben
authored
4 years ago
50
51
isLink?: boolean;
52
53
}
vben
authored
5 years ago
54
// @ts-ignore
55
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
vben
authored
5 years ago
56
name: string;
57
meta: RouteMeta;
vben
authored
5 years ago
58
component?: Component | string;
vben
authored
5 years ago
59
components?: Component;
60
children?: AppRouteRecordRaw[];
vben
authored
5 years ago
61
props?: Recordable;
vben
authored
5 years ago
62
fullPath?: string;
63
}
vben
authored
5 years ago
64
65
66
67
68
export interface MenuTag {
type?: 'primary' | 'error' | 'warn' | 'success';
content?: string;
dot?: boolean;
}
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
export interface Menu {
name: string;
icon?: string;
path: string;
disabled?: boolean;
children?: Menu[];
orderNo?: number;
roles?: RoleEnum[];
meta?: Partial<RouteMeta>;
vben
authored
5 years ago
86
87
tag?: MenuTag;
vben
authored
4 years ago
88
89
hideMenu?: boolean;
90
}
vben
authored
5 years ago
91
92
93
94
95
96
export interface MenuModule {
orderNo?: number;
menu: Menu;
}
vben
authored
5 years ago
97
98
// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
export type AppRouteModule = AppRouteRecordRaw;