XiaoRuby
2023-08-14 28243550e53fcdf0d8dc4d0dd20f8b35acb4f6ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import Vue from 'vue'
import Router from 'vue-router'
import Index from "../view/index.vue";
import NotFind from "../view/404.vue"
import Enter from "../view/enter.vue"
import { name } from 'file-loader';
 
Vue.use(Router)
 
//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
 
export default new Router({
  mode: 'history',
  routes: [{
    path: "/",
    component: Index
  }, 
  {
    path: "/enter",
    component: () => import("../view/enter.vue")
  },
  // 添加计量模块
  {
    path: "/measure",
    components: Index,
    redirect: "/manage",
    children: [
      {
        path: "/manage",
        name: "MeasureManage",
        component: () => import('../components/view/measure/index.vue')
      }
    ]
  }]
})