You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.9 KiB

7 months ago
  1. import type { RouteRecordRaw } from 'vue-router'
  2. import { defineComponent } from 'vue'
  3. /**
  4. * redirect: noredirect noredirect
  5. * name:'router-name' 使<keep-alive>
  6. * meta : {
  7. hidden: true true 404login等页面( false)
  8. alwaysShow: true children 1
  9. children
  10. alwaysShow: true
  11. ( false)
  12. title: 'title'
  13. titleSuffix: '2' path title
  14. icon: 'svg-name'
  15. noCache: true true <keep-alive> ( false)
  16. breadcrumb: false falsebreadcrumb面包屑中显示( true)
  17. affix: true truetag项中( false)
  18. noTagsView: true truetag中( false)
  19. activeMenu: '/home'
  20. followAuth: '/home'
  21. canTo: true true即使hidden为true( false)
  22. }
  23. **/
  24. declare module 'vue-router' {
  25. interface RouteMeta extends Record<string | number | symbol, unknown> {
  26. hidden?: boolean
  27. alwaysShow?: boolean
  28. title?: string
  29. titleSuffix?: string
  30. icon?: string
  31. noCache?: boolean
  32. breadcrumb?: boolean
  33. affix?: boolean
  34. activeMenu?: string
  35. noTagsView?: boolean
  36. followAuth?: string
  37. canTo?: boolean
  38. }
  39. }
  40. type Component<T = any> =
  41. | ReturnType<typeof defineComponent>
  42. | (() => Promise<typeof import('*.vue')>)
  43. | (() => Promise<T>)
  44. declare global {
  45. interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  46. name: string
  47. meta: RouteMeta
  48. component?: Component | string
  49. children?: AppRouteRecordRaw[]
  50. props?: Recordable
  51. fullPath?: string
  52. keepAlive?: boolean
  53. }
  54. interface AppCustomRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
  55. icon: any
  56. name: string
  57. meta: RouteMeta
  58. component: string
  59. componentName?: string
  60. path: string
  61. redirect: string
  62. children?: AppCustomRouteRecordRaw[]
  63. keepAlive?: boolean
  64. visible?: boolean
  65. parentId?: number
  66. alwaysShow?: boolean
  67. }
  68. }