index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import layout from '@/layout/index.vue';
  4. const originalPush = VueRouter.prototype.push;
  5. VueRouter.prototype.push = function push(location) {
  6. return originalPush.call(this, location).catch((err) => err);
  7. };
  8. Vue.use(VueRouter);
  9. const router = new VueRouter({
  10. mode: 'history',
  11. // scrollBehavior(to, from, savedPosition) {
  12. // if (savedPosition) {
  13. // return savedPosition;
  14. // } else {
  15. // return { x: 0, y: 0 };
  16. // }
  17. // },
  18. base: '/agent/',
  19. routes: [
  20. {
  21. path: '/',
  22. component: layout,
  23. redirect: '/home',
  24. children: [
  25. {
  26. path: '/home',
  27. name: 'home',
  28. component: () => import('@/views/home/index.vue'),
  29. meta: {
  30. title: '经销商拜访',
  31. },
  32. },
  33. {
  34. path: '/visitPage',
  35. name: 'visitPage',
  36. component: () => import('@/views/home/visitPage.vue'),
  37. meta: {
  38. title: '拜访详情',
  39. },
  40. },
  41. {
  42. path: '/visitTask',
  43. name: 'visitTask',
  44. component: () => import('@/views/home/visitTask.vue'),
  45. meta: {
  46. title: '拜访任务',
  47. },
  48. },
  49. {
  50. path: '/visitHistory',
  51. name: 'visitHistory',
  52. component: () => import('@/views/home/visitHistory.vue'),
  53. meta: {
  54. title: '拜访历史',
  55. },
  56. },
  57. ],
  58. },
  59. {
  60. path: '/err',
  61. name: 'err',
  62. component: () => import('@/views/err.vue'),
  63. meta: {
  64. title: '404',
  65. },
  66. },
  67. {
  68. path: '/login',
  69. name: 'login',
  70. component: () => import('@/views/login.vue'),
  71. meta: {
  72. title: '登录',
  73. },
  74. },
  75. ],
  76. });
  77. export default router;