yuyu
2023-08-02 4935da798824442f2e14815376a9153840ed1541
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
import Vue from 'vue'
import Router from 'vue-router'
import Index from "../view/index";
import NotFind from "../view/404.vue"
import Enter from "../view/enter.vue"
 
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")
  }]
})