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
41
42
43
44
45
46
47
48
49
| import Vue from "vue";
| import Router from "vue-router";
| import Login from "./views/Login.vue";
| import Layout from "./views/Layout.vue";
| import Register from "./views/register.vue";
| Vue.use(Router);
|
| const originalPush = Router.prototype.push;
| Router.prototype.push = function push(location: any) {
| return (originalPush.call(this, location) as any).catch((err: any) => err);
| };
| // const originalPush = Router.prototype.push;
| // Router.prototype.push = function push(location: any) {
| // return originalPush.call(this, location).catch((err: any) => err);
| // };
|
| const router = new Router({
| mode: "history",
| routes: [
| {
| path: "/",
| name: "Login",
| component: Login
| },
| {
| path: "/Register",
| name: "Register",
| component: Register
| },
| {
| path: "/Layout",
| name: "Layout",
| component: Layout,
| children: [
|
| ]
| }
| ]
| });
|
| router.beforeEach((to, from, next)=>{
| // console.log(to.query,from,'before')
| // if(from.path !== '/'){
| // this.CardList.details = []
| // }
| next()
| })
|
| export default router;
|
|