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