Fixiaobai
2023-10-08 d6781631162d56fcd59e2f6df0c3eb41e151e4b2
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
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")
  }]
})