router.ts 902 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type { ReactNode } from 'react'
  2. import type { Params, RouteObject } from 'react-router'
  3. export interface RouteMeta {
  4. /**
  5. * antd menu selectedKeys
  6. */
  7. key: string
  8. /**
  9. * menu label, i18n
  10. */
  11. label: string
  12. /**
  13. * menu prefix icon
  14. */
  15. icon?: ReactNode
  16. /**
  17. * menu suffix icon
  18. */
  19. suffix?: ReactNode
  20. /**
  21. * hide in menu
  22. */
  23. hideMenu?: boolean
  24. /**
  25. * hide in multi tab
  26. */
  27. hideTab?: boolean
  28. /**
  29. * disable in menu
  30. */
  31. disabled?: boolean
  32. /**
  33. * react router outlet
  34. */
  35. outlet?: ReactNode
  36. /**
  37. * use to refresh tab
  38. */
  39. timeStamp?: string
  40. /**
  41. * external link and iframe need
  42. */
  43. frameSrc?: URL
  44. /**
  45. * dynamic route params
  46. *
  47. * @example /user/:id
  48. */
  49. params?: Params<string>
  50. }
  51. export type AppRouteObject = {
  52. order?: number
  53. meta?: RouteMeta
  54. children?: AppRouteObject[]
  55. } & Omit<RouteObject, 'children'>