index.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { createRouter, createWebHistory } from 'vue-router'
  2. export const homeIndex = () => import('@/views/home/index.vue')
  3. export const Layout = () => import('@/layout/index.vue')
  4. const system = [
  5. {
  6. path: '/system/menus',
  7. meta: { title: '菜单管理' },
  8. component: () => import('@/views/system/menus/index.vue')
  9. },
  10. {
  11. path: '/system/role',
  12. meta: { title: '角色管理' },
  13. component: () => import('@/views/system/role/index.vue')
  14. },
  15. {
  16. path: '/system/dict',
  17. meta: { title: '字典管理' },
  18. component: () => import('@/views/system/dict/index.vue')
  19. },
  20. {
  21. path: '/system/dictData',
  22. meta: { title: '字典数据管理' },
  23. component: () => import('@/views/system/dictData/index.vue')
  24. },
  25. {
  26. path: '/system/config',
  27. meta: { title: '平台设置' },
  28. component: () => import('@/views/system/config/index.vue')
  29. },
  30. {
  31. path: '/system/module',
  32. meta: { title: '模块设置' },
  33. component: () => import('@/views/system/module/index.vue')
  34. }
  35. ]
  36. const router = createRouter({
  37. history: createWebHistory(import.meta.env.BASE_URL),
  38. routes: [
  39. {
  40. path: '/redirect',
  41. component: Layout,
  42. meta: { hidden: true },
  43. children: [
  44. {
  45. path: '/redirect/:path(.*)',
  46. component: () => import('@/views/redirect/index.vue')
  47. }
  48. ]
  49. },
  50. {
  51. path: '/login',
  52. name: 'login',
  53. meta: { title: '账号登录' },
  54. component: () => import('@/views/login/index.vue')
  55. },
  56. {
  57. path: '/',
  58. meta: { title: '首页' },
  59. component: Layout,
  60. redirect: '/dashboard',
  61. children: [
  62. {
  63. path: '/',
  64. name: 'dashboard',
  65. meta: {
  66. title: '首页',
  67. affix: true,
  68. keepAlive: true,
  69. alwaysShow: false
  70. },
  71. component: () => import('@/views/home/index.vue')
  72. },
  73. ...system
  74. ]
  75. }
  76. ]
  77. })
  78. export default router