types.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. // @ts-ignore
  8. export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  9. name: string;
  10. meta: RouteMeta;
  11. component?: Component | string;
  12. components?: Component;
  13. children?: AppRouteRecordRaw[];
  14. props?: Recordable;
  15. fullPath?: string;
  16. }
  17. export interface Meta {
  18. // 名称
  19. title: string;
  20. // 是否忽略权限
  21. ignoreAuth?: boolean;
  22. //权限数组集合
  23. permissions?: string[];
  24. // 是否不缓存 预留功能 并未生效
  25. noKeepAlive?: boolean;
  26. // 是否固定在tab上
  27. affix?: boolean;
  28. // tab上的图标
  29. icon?: string;
  30. // 跳转地址
  31. frameSrc?: string;
  32. // 外链跳转地址
  33. externalLink?: string;
  34. //隐藏
  35. hidden?: boolean;
  36. }
  37. export interface Menu {
  38. title: string;
  39. label: string;
  40. key: string;
  41. meta: RouteMeta;
  42. name: string;
  43. component?: Component | string;
  44. components?: Component;
  45. children?: AppRouteRecordRaw[];
  46. props?: Recordable;
  47. fullPath?: string;
  48. icon?: any;
  49. path: string;
  50. permissions?: string[];
  51. redirect?: string;
  52. sort?: number;
  53. }