index.js 726 B

123456789101112131415161718192021222324252627282930313233343536
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. // 优化同一路由跳转报错
  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 routes = [
  10. {
  11. path: '/',
  12. name: 'Lithology',
  13. component: () => import('../views/Lithology.vue')
  14. },
  15. {
  16. path: '/Grain',
  17. name: 'Grain',
  18. component: () => import('../views/Grain.vue')
  19. },
  20. {
  21. path: '/Result',
  22. name: 'Result',
  23. component: () => import('../views/Result.vue')
  24. },
  25. {
  26. path: '*',
  27. redirect: '/Lithology'
  28. }
  29. ]
  30. const router = new VueRouter({
  31. routes,
  32. mode: 'hash'
  33. })
  34. export default router