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