route.ts 3.0 KB

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