index.js
2.14 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import Vue from 'vue'
import VueRouter from 'vue-router'
// 解决 vue-router 重复路由访问报错
const originPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originPush.call(this, location).catch(err => err)
}
// layout
import { PageLayout, BasicLayout } from '../layouts'
Vue.use(VueRouter)
/**
* 基础路由
*/
export const constantRoutes = [
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/index')
},
{
path: '/404',
component: () => import('@/views/error-page/404')
},
{
path: '/',
component: BasicLayout,
redirect: '/account',
children: [
{
path: 'account',
name: 'Account',
component: () => import('@/views/report/account/index'),
meta: {}
}
]
},
{
path: '/analysis',
component: PageLayout,
redirect: '/analysis/seqasis',
children: [
{
path: 'seqasis',
name: 'Seqasis',
component: () => import('@/views/analysis/seqasis/index'),
meta: {}
}
]
},
{
path: '/behavior',
component: PageLayout,
redirect: '/behavior/mallgroup',
children: [
{
path: 'mallgroup',
name: 'mallgroup',
component: () => import('@/views/behavior/mallgroup/index'),
meta: {}
}
]
},
{
path: '/dataasis',
component: BasicLayout,
redirect: '/dataasis/trafficasis',
children: [
{
path: 'trafficasis',
name: 'trafficasis',
component: () => import('@/views/dataasis/analysis-report/index'),
meta: {}
}
]
},
{
path: '/manage',
component: PageLayout,
redirect: '/manage/blocmanage',
children: [
{
path: 'blocmanage',
name: 'blocmanage',
component: () => import('@/views/manage/bloc-manage/index'),
meta: {}
}
]
}
]
export const asyncRoutes = [
{
//
},
{ path: '*', redirect: '/404' }
]
const router = new VueRouter({
// mode: 'history',
// base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
export default router