index.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import { createRouter, createWebHistory, RouteRecordRaw, createWebHashHistory, Router } from 'vue-router'
  2. import Layout from "@/layout/index.vue";
  3. // 扩展继承属性
  4. interface extendRoute {
  5. hidden?: boolean
  6. }
  7. //
  8. import tableRouter from './modules/table'
  9. import dataScreenRouter from './modules/dataScreen'
  10. import excelRouter from './modules/excel'
  11. import nestedRouter from './modules/nested'
  12. import systemRouter from './modules/system'
  13. import echartsRouter from './modules/echarts'
  14. import chatRouter from './modules/chat'
  15. import othersRouter from './modules/other'
  16. import externalLink from './modules/externalLink'
  17. import formRouter from './modules/form'
  18. import functionPageRouter from './modules/functionPage'
  19. import playerInfo from './modules/player'
  20. import serverRouter from './modules/server'
  21. import operationRouter from './modules/operation'
  22. import activityRouter from './modules/activity'
  23. // 异步组件
  24. export const asyncRoutes = [
  25. // ...echartsRouter,
  26. // ...tableRouter,
  27. // ...formRouter,
  28. // ...othersRouter,
  29. // ...functionPageRouter,
  30. // ...chatRouter,
  31. // ...nestedRouter,
  32. // ...excelRouter,
  33. // ...externalLink,
  34. // 临时注释
  35. // ...playerInfo,
  36. // ...dataScreenRouter,
  37. ...systemRouter,
  38. ...serverRouter,
  39. ...operationRouter,
  40. ...activityRouter
  41. ]
  42. /**
  43. * path ==> 路由路径
  44. * name ==> 路由名称
  45. * component ==> 路由组件
  46. * redirect ==> 路由重定向
  47. * alwaysShow ==> 如果设置为true,将始终显示根菜单,无论其子路由长度如何
  48. * hidden ==> 如果“hidden:true”不会显示在侧边栏中(默认值为false)
  49. * keepAlive ==> 设为true 缓存
  50. * meta ==> 路由元信息
  51. * meta.title ==> 路由标题
  52. * meta.icon ==> 菜单icon
  53. * meta.affix ==> 如果设置为true将会出现在 标签栏中
  54. * meta.breadcrumb ==> 如果设置为false,该项将隐藏在breadcrumb中(默认值为true)
  55. */
  56. export const constantRoutes: Array<RouteRecordRaw & extendRoute> = [
  57. {
  58. path: "/404",
  59. name: "404",
  60. component: () => import("@/views/errorPages/404.vue"),
  61. hidden: true,
  62. },
  63. {
  64. path: "/403",
  65. name: "403",
  66. component: () => import("@/views/errorPages/403.vue"),
  67. hidden: true,
  68. },
  69. {
  70. path: '/login',
  71. name: 'Login',
  72. component: () => import('@/views/login/index.vue'),
  73. hidden: true,
  74. meta: { title: '登录', }
  75. },
  76. {
  77. path: '/',
  78. name: 'layout',
  79. component: Layout,
  80. redirect: '/player/index',
  81. meta: {
  82. title: '玩家信息',
  83. icon: 'chat-square'
  84. },
  85. children: [
  86. {
  87. path: '/player/index',
  88. component: () => import('@/views/player/index.vue'),
  89. name: 'chat-square',
  90. meta: { title: '玩家信息', icon: 'House', affix: true ,role:['other']}
  91. }
  92. ]
  93. },
  94. // {
  95. // path: '/',
  96. // name: 'layout',
  97. // component: Layout,
  98. // redirect: '/home',
  99. // meta: { title: '首页', icon: 'House', },
  100. // children: [
  101. // {
  102. // path: '/home',
  103. // component: () => import('@/views/home/index.vue'),
  104. // name: 'home',
  105. // meta: { title: '首页', icon: 'House', affix: true ,role:['other']}
  106. // },
  107. // ]
  108. // },
  109. ]
  110. /**
  111. * notFoundRouter(找不到路由)
  112. */
  113. export const notFoundRouter = {
  114. path: '/:pathMatch(.*)',
  115. name: "notFound",
  116. redirect: '/404'
  117. };
  118. const router = createRouter({
  119. // history: createWebHistory(process.env.BASE_URL), // history
  120. history: createWebHashHistory(), // hash
  121. routes: constantRoutes
  122. })
  123. export default router