route.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import { RouteRecordRaw } from 'vue-router';
  2. /**
  3. * 路由meta对象参数说明
  4. * meta: {
  5. * title: 菜单栏及 tagsView 栏、菜单搜索名称(国际化)
  6. * isLink: 是否超链接菜单,开启外链条件,`1、isLink:true 2、链接地址不为空`
  7. * isHide: 是否隐藏此路由
  8. * isKeepAlive: 是否缓存组件状态
  9. * isAffix: 是否固定在 tagsView 栏上
  10. * isIframe: 是否内嵌窗口,,开启条件,`1、isIframe:true 2、链接地址不为空`
  11. * roles: 当前路由权限标识,取角色管理。控制路由显示、隐藏。超级管理员:admin 普通角色:common
  12. * icon: 菜单、tagsView 图标,阿里:加 `iconfont xxx`,fontawesome:加 `fa xxx`
  13. * }
  14. */
  15. /**
  16. * 定义动态路由
  17. * @description 未开启 isRequestRoutes 为 true 时使用(前端控制路由),开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
  18. * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
  19. * @returns 返回路由菜单数据
  20. */
  21. export const dynamicRoutes: Array<RouteRecordRaw> = [
  22. {
  23. path: '/',
  24. name: '/',
  25. component: () => import('/@/layout/index.vue'),
  26. redirect: '/home',
  27. meta: {
  28. isKeepAlive: true,
  29. },
  30. children: [
  31. // {
  32. // path: '/home',
  33. // name: 'home',
  34. // component: () => import('/@/views/home/index.vue'),
  35. // meta: {
  36. // title: 'message.router.home',
  37. // isLink: '',
  38. // isHide: false,
  39. // isKeepAlive: true,
  40. // isAffix: true,
  41. // isIframe: false,
  42. // roles: ['admin', 'common'],
  43. // icon: 'iconfont icon-shouye',
  44. // },
  45. // },
  46. {
  47. path: '/personal',
  48. name: 'personal',
  49. component: () => import('/@/views/personal/index.vue'),
  50. meta: {
  51. title: 'message.router.personal',
  52. isLink: '',
  53. isHide: true,
  54. isKeepAlive: true,
  55. isAffix: false,
  56. isIframe: false,
  57. roles: ['admin', 'common'],
  58. icon: 'iconfont icon-gerenzhongxin',
  59. },
  60. },
  61. {
  62. path: '/404',
  63. name: 'notFound',
  64. component: () => import('/@/views/error/404.vue'),
  65. meta: {
  66. title: 'message.staticRoutes.notFound',
  67. isLink: '',
  68. isHide: true,
  69. isKeepAlive: true,
  70. isAffix: false,
  71. isIframe: false,
  72. },
  73. },
  74. {
  75. path: '/401',
  76. name: 'noPower',
  77. component: () => import('/@/views/error/401.vue'),
  78. meta: {
  79. title: 'message.staticRoutes.noPower',
  80. isLink: '',
  81. isHide: true,
  82. isKeepAlive: true,
  83. isAffix: false,
  84. isIframe: false,
  85. },
  86. },
  87. ],
  88. },
  89. ];
  90. /**
  91. * 定义静态路由
  92. * @description 前端控制直接改 dynamicRoutes 中的路由,后端控制不需要修改,请求接口路由数据时,会覆盖 dynamicRoutes 第一个顶级 children 的内容(全屏,不包含 layout 中的路由出口)
  93. * @returns 返回路由菜单数据
  94. */
  95. export const staticRoutes: Array<RouteRecordRaw> = [
  96. {
  97. path: '/login',
  98. name: 'login',
  99. component: () => import('/@/views/login/index.vue'),
  100. meta: {
  101. title: '登录',
  102. },
  103. }
  104. /**
  105. * 提示:写在这里的为全屏界面,不建议写在这里
  106. * 请写在 `dynamicRoutes` 路由数组中
  107. */
  108. ];