types.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import type { RouteRecordRaw } from 'vue-router';
  2. import { RoleEnum } from '/@/enums/roleEnum';
  3. import type { Component } from '/@/components/types';
  4. export interface RouteMeta {
  5. // title
  6. title: string;
  7. // Whether to ignore permissions
  8. ignoreAuth?: boolean;
  9. // role info
  10. roles?: RoleEnum[];
  11. // Whether not to cache
  12. ignoreKeepAlive?: boolean;
  13. // Is it fixed on tab
  14. affix?: boolean;
  15. // icon on tab
  16. icon?: string;
  17. frameSrc?: string;
  18. // current page transition
  19. transitionName?: string;
  20. // Whether the route has been dynamically added
  21. hideBreadcrumb?: boolean;
  22. // Carrying parameters
  23. carryParam?: boolean;
  24. // Used internally to mark single-level menus
  25. single?: boolean;
  26. }
  27. // @ts-ignore
  28. export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  29. name: string;
  30. meta: RouteMeta;
  31. component?: Component;
  32. components?: Component;
  33. children?: AppRouteRecordRaw[];
  34. props?: Record<string, any>;
  35. fullPath?: string;
  36. }
  37. export interface MenuTag {
  38. type?: 'primary' | 'error' | 'warn' | 'success';
  39. content?: string;
  40. dot?: boolean;
  41. }
  42. export interface Menu {
  43. name: string;
  44. icon?: string;
  45. path: string;
  46. disabled?: boolean;
  47. children?: Menu[];
  48. orderNo?: number;
  49. roles?: RoleEnum[];
  50. meta?: Partial<RouteMeta>;
  51. tag?: MenuTag;
  52. }
  53. export interface MenuModule {
  54. orderNo?: number;
  55. menu: Menu;
  56. }
  57. // interface RouteModule {
  58. // layout: AppRouteRecordRaw;
  59. // routes: AppRouteRecordRaw[];
  60. // children?: AppRouteRecordRaw[];
  61. // component?: Component;
  62. // }
  63. // export type AppRouteModule = RouteModule | AppRouteRecordRaw;
  64. export type AppRouteModule = AppRouteRecordRaw;