types.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import type { RouteRecordRaw, RouteMeta } from 'vue-router';
  2. import { RoleEnum } from '/@/enums/roleEnum';
  3. import { defineComponent } from 'vue';
  4. export type Component<T extends any = any> = ReturnType<typeof defineComponent> | (() => Promise<typeof import('*.vue')>) | (() => Promise<T>);
  5. // @ts-ignore
  6. export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  7. name: string;
  8. meta: RouteMeta;
  9. component?: Component | string;
  10. components?: Component;
  11. children?: AppRouteRecordRaw[];
  12. props?: Recordable;
  13. fullPath?: string;
  14. alwaysShow?: boolean;
  15. }
  16. export interface MenuTag {
  17. type?: 'primary' | 'error' | 'warn' | 'success';
  18. content?: string;
  19. dot?: boolean;
  20. }
  21. export interface Menu {
  22. name: string;
  23. icon?: string;
  24. path: string;
  25. // path contains param, auto assignment.
  26. paramPath?: string;
  27. disabled?: boolean;
  28. children?: Menu[];
  29. orderNo?: number;
  30. roles?: RoleEnum[];
  31. meta?: Partial<RouteMeta>;
  32. tag?: MenuTag;
  33. hideMenu?: boolean;
  34. alwaysShow?: boolean;
  35. }
  36. export interface MenuModule {
  37. orderNo?: number;
  38. menu: Menu;
  39. }
  40. // export type AppRouteModule = RouteModule | AppRouteRecordRaw;
  41. export type AppRouteModule = AppRouteRecordRaw;