index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. Vue.use(VueRouter)
  4. const originalPush = VueRouter.prototype.push
  5. VueRouter.prototype.push = function push(location) {
  6. return originalPush.call(this, location).catch(err => err)
  7. }
  8. const routes = [
  9. {
  10. path: "/",
  11. component: () => import('@/views/index'),
  12. },
  13. {
  14. path:'/login',
  15. name:'Login',
  16. meta: {
  17. title: '系统登录'
  18. },
  19. component: () => import("@/views/login/index.vue")
  20. },
  21. {
  22. path: "",
  23. component: () => import('@/views/layout/index.vue'),
  24. children:[
  25. {
  26. path:'/caseList',
  27. name:'CaseList',
  28. meta: {
  29. title: '案件列表'
  30. },
  31. component: () => import("@/views/caseList/index.vue")
  32. },
  33. {
  34. path:'/differenceDetails',
  35. name:'DifferenceDetails',
  36. meta: {
  37. title: '差异度详情'
  38. },
  39. component: () => import("@/views/differenceDetails/index.vue")
  40. },
  41. //查看文件
  42. {
  43. path: '/checkFile',
  44. name: '/checkFile',
  45. meta: {
  46. aside: true,
  47. sign: 'checkFile',
  48. },
  49. component: () => import('@/views/components/view/checkFile.vue'),
  50. },
  51. ]
  52. },
  53. ]
  54. const router = new VueRouter({
  55. mode: 'history',
  56. base: '/',
  57. routes
  58. })
  59. router.beforeEach((to, from, next) => {
  60. if (to.meta.title) {
  61. document.title = to.meta.title;
  62. }
  63. next();
  64. })
  65. router.afterEach((to, from) => {
  66. });
  67. export default router