uo
chenyc
2022-09-09 a939b60c9819df65c4eb59fb3164e5ad179ae854
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {
    createRouter, createWebHashHistory, RouteRecordRaw,
} from 'vue-router'
import { cancelRequest } from '@/utils/axios'
 
const routes: Array<RouteRecordRaw> = [
    { path: '/', name: 'Home', component: () => import('views/home/index.vue')},
    { path: '/test', name: 'Test', component: () => import('views/test.vue')}
]
 
const router = createRouter({
    history: createWebHashHistory(),
    routes,
})
 
router.beforeEach((to, from, next) => {
    cancelRequest()
    next()
})
 
export default router