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

69 lines
1.5 KiB

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: 'index',
  19. // 路由级代码拆分,这将为此路由生成单独的块,当路线被访问时延迟加载 (路由懒加载)
  20. component: () => import('./views/index/index1'),
  21. meta: {
  22. title: '测试',
  23. requireAuth: true //不需要验证登录
  24. }
  25. },
  26. {
  27. path: '/login',
  28. name: 'login',
  29. component: () => import('./views/login/login'),
  30. meta: {
  31. title: '登录',
  32. requireAuth: true //不需要验证登录
  33. }
  34. },
  35. {
  36. path: '/',
  37. name: 'home',
  38. component: () => import('./views/home'),
  39. redirect: 'index',
  40. meta: {
  41. },
  42. children: [
  43. {
  44. path: 'index',
  45. name: 'Index',
  46. component: () => import('./views/index/index'),
  47. meta: {
  48. title: '首页',
  49. },
  50. }
  51. ]
  52. },
  53. ],
  54. linkActiveClass: 'active', //当前完全路由的样式 一般有子路由时用
  55. scrollBehavior(to, from, savedPosition) { //to 要跳转到的路由 from从哪个路由调到哪个路由 savedPosition 当前滚动条的位置
  56. if (savedPosition) {
  57. return savedPosition
  58. } else {
  59. return {
  60. x: 0,
  61. y: 0
  62. }
  63. }
  64. },
  65. })