types.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import type { RouteRecordRaw, RouteMeta } from 'vue-router';
  2. import { defineComponent } from 'vue';
  3. export type Component<T extends any = any> =
  4. | ReturnType<typeof defineComponent>
  5. | (() => Promise<typeof import('*.vue')>)
  6. | (() => Promise<T>);
  7. export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  8. name: string;
  9. meta: RouteMeta;
  10. component?: Component | string;
  11. components?: Component;
  12. children?: AppRouteRecordRaw[];
  13. props?: any;
  14. fullPath?: string;
  15. }
  16. export interface Meta {
  17. // 名称
  18. title: string;
  19. // 是否忽略权限
  20. ignoreAuth?: boolean;
  21. permissions?: string[];
  22. // 是否不缓存
  23. noKeepAlive?: boolean;
  24. // 是否固定在tab上
  25. affix?: boolean;
  26. // tab上的图标
  27. icon?: string;
  28. // 跳转地址
  29. frameSrc?: string;
  30. // 外链跳转地址
  31. externalLink?: string;
  32. //隐藏
  33. hidden?: boolean;
  34. }
  35. export interface Menu {
  36. title: string;
  37. label: string;
  38. key: string;
  39. meta: RouteMeta;
  40. name: string;
  41. component?: Component | string;
  42. components?: Component;
  43. children?: AppRouteRecordRaw[];
  44. props?: any;
  45. fullPath?: string;
  46. icon?: any;
  47. path: string;
  48. permissions?: string[];
  49. redirect?: string;
  50. sort?: number;
  51. }