Blame view

src/router/types.ts 1.07 KB
Vben authored
1
import type { RouteRecordRaw, RouteMeta } from 'vue-router';
陈文彬 authored
2
import { RoleEnum } from '/@/enums/roleEnum';
vben authored
3
4
5
6
7
8
import { defineComponent } from 'vue';

export type Component<T extends any = any> =
  | ReturnType<typeof defineComponent>
  | (() => Promise<typeof import('*.vue')>)
  | (() => Promise<T>);
9
10

// @ts-ignore
陈文彬 authored
11
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
12
  name: string;
陈文彬 authored
13
  meta: RouteMeta;
14
  component?: Component | string;
vben authored
15
  components?: Component;
陈文彬 authored
16
  children?: AppRouteRecordRaw[];
vben authored
17
  props?: Recordable;
vben authored
18
  fullPath?: string;
陈文彬 authored
19
}
Vben authored
20
21
22
23
24
25
export interface MenuTag {
  type?: 'primary' | 'error' | 'warn' | 'success';
  content?: string;
  dot?: boolean;
}
陈文彬 authored
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

export interface Menu {
  name: string;

  icon?: string;

  path: string;

  disabled?: boolean;

  children?: Menu[];

  orderNo?: number;

  roles?: RoleEnum[];

  meta?: Partial<RouteMeta>;
43
44

  tag?: MenuTag;
45
46

  hideMenu?: boolean;
陈文彬 authored
47
}
48
陈文彬 authored
49
50
51
52
53
export interface MenuModule {
  orderNo?: number;
  menu: Menu;
}
vben authored
54
55
// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
export type AppRouteModule = AppRouteRecordRaw;