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
| import Vue from 'vue';
| import Router from 'vue-router'
|
| import {
| constantRouterMap,
| asyncRouterMap
| } from '@/config/router.config.js'
|
|
| Vue.use(Router)
|
| /*实例化路由*/
| const router = new Router({
| mode: "history", //模式修改
| routes: asyncRouterMap,
| scrollBehavior (to, from, savedPosition) {
|
| //路由切换是否滚动到顶部
| if (savedPosition) {
| return savedPosition
| } else {
| return { x: 0, y: 0 }
| }
| }
| })
|
| router.beforeEach((to, from, next) => {
| window.document.title = to.meta.title == undefined?'在你左边,听风及雨':to.meta.title
| next();
| })
|
|
| /*导出路由模块*/
| export default router
|
|