types.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. ver?: string;
  16. }
  17. export interface MenuTag {
  18. type?: 'primary' | 'error' | 'warn' | 'success';
  19. content?: string;
  20. dot?: boolean;
  21. }
  22. export interface Menu {
  23. name: string;
  24. icon?: string;
  25. path: string;
  26. // path contains param, auto assignment.
  27. paramPath?: string;
  28. disabled?: boolean;
  29. children?: Menu[];
  30. orderNo?: number;
  31. roles?: RoleEnum[];
  32. meta?: Partial<RouteMeta>;
  33. tag?: MenuTag;
  34. hideMenu?: boolean;
  35. alwaysShow?: boolean;
  36. }
  37. export interface MenuModule {
  38. orderNo?: number;
  39. menu: Menu;
  40. }
  41. // export type AppRouteModule = RouteModule | AppRouteRecordRaw;
  42. export type AppRouteModule = AppRouteRecordRaw;