types.d.ts 1.6 KB
Newer Older
陈文彬 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
import type { RouteRecordRaw } from 'vue-router';
import { RoleEnum } from '/@/enums/roleEnum';
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;
  // Jump address
  frameSrc?: string;
  // Outer link jump address
  externalLink?: string;

  // current page transition
  transitionName?: string;

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

  // disabled redirect
  disabledRedirect?: boolean;
陈文彬 已提交
29 30 31

  // close loading
  afterCloseLoading?: boolean;
V
vben 已提交
32
  // Is it in the tab
N
nebv 已提交
33
  inTab?: boolean;
V
vben 已提交
34 35
  // Carrying parameters
  carryParam?: boolean;
陈文彬 已提交
36 37 38 39 40 41 42 43
}

export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  meta: RouteMeta;
  component?: any;
  components?: any;
  children?: AppRouteRecordRaw[];
  props?: any;
V
vben 已提交
44
  fullPath?: string;
陈文彬 已提交
45
}
V
vben 已提交
46 47 48 49 50
export interface MenuTag {
  type?: 'primary' | 'error' | 'warn' | 'success';
  content?: string;
  dot?: boolean;
}
陈文彬 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

export interface Menu {
  name: string;

  icon?: string;

  path: string;

  disabled?: boolean;

  children?: Menu[];

  orderNo?: number;

  roles?: RoleEnum[];

  meta?: Partial<RouteMeta>;
V
vben 已提交
68 69

  tag?: MenuTag;
陈文彬 已提交
70 71 72 73 74 75
}
export interface MenuModule {
  orderNo?: number;
  menu: Menu;
}

V
vben 已提交
76 77 78
interface RouteModule {
  layout: AppRouteRecordRaw;
  routes: AppRouteRecordRaw[];
79 80
  children?: AppRouteRecordRaw[];
  component?: any;
陈文彬 已提交
81
}
V
vben 已提交
82 83

export type AppRouteModule = RouteModule | AppRouteRecordRaw;