前端投屏pc/h5
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.

109 lines
2.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. export default new Router({
  5. routes: [
  6. {
  7. path: '/index',
  8. name: 'index',
  9. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  10. component: () => import('./views/index/index'),
  11. meta: {
  12. title: '首页',
  13. requireAuth: true //不需要验证登录
  14. }
  15. },
  16. {
  17. path: '/index1',
  18. name: 'index1',
  19. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  20. component: () => import('./views/index/index1'),
  21. meta: {
  22. title: '首页1',
  23. requireAuth: true //不需要验证登录
  24. }
  25. },
  26. {
  27. path: '/index2',
  28. name: 'index2',
  29. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  30. component: () => import('./views/index/index2'),
  31. meta: {
  32. title: '首页2',
  33. requireAuth: true //不需要验证登录
  34. }
  35. },
  36. {
  37. path: '/index3',
  38. name: 'index3',
  39. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  40. component: () => import('./views/index/index3'),
  41. meta: {
  42. title: '首页3',
  43. requireAuth: true //不需要验证登录
  44. }
  45. },
  46. {
  47. path: '/index4',
  48. name: 'index4',
  49. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  50. component: () => import('./views/index/index4'),
  51. meta: {
  52. title: '首页4',
  53. requireAuth: true //不需要验证登录
  54. }
  55. },
  56. {
  57. path: '/index5',
  58. name: 'index5',
  59. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  60. component: () => import('./views/index/index5'),
  61. meta: {
  62. title: '首页5',
  63. requireAuth: true //不需要验证登录
  64. }
  65. },
  66. {
  67. path: '/login',
  68. name: 'login',
  69. component: () => import('./views/login/login'),
  70. meta: {
  71. title: '登录',
  72. requireAuth: true //不需要验证登录
  73. }
  74. },
  75. {
  76. path: '/',
  77. name: 'home',
  78. component: () => import('./views/home'),
  79. redirect: 'index',
  80. meta: {
  81. },
  82. children: [
  83. {
  84. path: 'index',
  85. name: 'Index',
  86. component: () => import('./views/index/index'),
  87. meta: {
  88. title: '首页',
  89. },
  90. }
  91. ]
  92. },
  93. ],
  94. linkActiveClass: 'active', //当前完全路由的样式 一般有子路由时用
  95. scrollBehavior(to, from, savedPosition) { //to 要跳转到的路由 from从哪个路由调到哪个路由 savedPosition 当前滚动条的位置
  96. if (savedPosition) {
  97. return savedPosition
  98. } else {
  99. return {
  100. x: 0,
  101. y: 0
  102. }
  103. }
  104. },
  105. })