李林
2023-07-31 3306f59e3129058312cd4739ed0ea0f88d74d025
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
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")
  }]
})