types.d.ts 1.6 KB
Newer Older
陈文彬 已提交
1 2
import type { RouteRecordRaw } from 'vue-router';
import { RoleEnum } from '/@/enums/roleEnum';
V
vben 已提交
3
import Component from '/@/components/types';
陈文彬 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16
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;
V
vben 已提交
17 18

  frameSrc?: string;
陈文彬 已提交
19 20 21 22 23 24 25

  // current page transition
  transitionName?: string;

  // Whether the route has been dynamically added
  hideBreadcrumb?: boolean;

V
vben 已提交
26 27
  // Carrying parameters
  carryParam?: boolean;
V
vben 已提交
28

V
vben 已提交
29
  // Used internally to mark single-level menus
V
vben 已提交
30
  single?: boolean;
陈文彬 已提交
31 32 33
}

export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
V
vben 已提交
34
  name: string;
陈文彬 已提交
35
  meta: RouteMeta;
V
vben 已提交
36 37
  component?: Component;
  components?: Component;
陈文彬 已提交
38
  children?: AppRouteRecordRaw[];
V
vben 已提交
39
  props?: Record<string, any>;
V
vben 已提交
40
  fullPath?: string;
陈文彬 已提交
41
}
V
vben 已提交
42 43 44 45 46
export interface MenuTag {
  type?: 'primary' | 'error' | 'warn' | 'success';
  content?: string;
  dot?: boolean;
}
陈文彬 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

export interface Menu {
  name: string;

  icon?: string;

  path: string;

  disabled?: boolean;

  children?: Menu[];

  orderNo?: number;

  roles?: RoleEnum[];

  meta?: Partial<RouteMeta>;
V
vben 已提交
64 65

  tag?: MenuTag;
陈文彬 已提交
66
}
V
vben 已提交
67

陈文彬 已提交
68 69 70 71 72
export interface MenuModule {
  orderNo?: number;
  menu: Menu;
}

V
vben 已提交
73 74 75 76 77 78
// interface RouteModule {
//   layout: AppRouteRecordRaw;
//   routes: AppRouteRecordRaw[];
//   children?: AppRouteRecordRaw[];
//   component?: Component;
// }
V
vben 已提交
79

V
vben 已提交
80 81
// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
export type AppRouteModule = AppRouteRecordRaw;