zhouhao
2022-01-10 8adc5b5f8085101034d3381213f82036ca46426a
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
/*
 * @Author: 小明丶
 * @Date: 2019-08-19 15:23:17
 * @LastEditors: 小明丶
 * @LastEditTime: 2021-01-08 10:00:52
 * @Description:
 */
import Vue from "vue";
import VueRouter from 'vue-router';
import routes from './routes';
import Store from '@/store';
Vue.use(VueRouter);
 
let router =  new VueRouter({
    mode:"hash", //history
    routes,
    scrollBehavior (to, from, savedPosition) {
        return {
            x:0,
            y:0
        }
    },
})
 
 
// 全局前置守卫:页面跳转前拦截
router.beforeEach((to, from, next) => {
    next()
})
 
 
//全局后置守卫:页面跳转后执行
router.afterEach((to, from) => {
 
})
 
export default router;