2026-02-06 15:10:17 +08:00
|
|
|
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 路由缓存机制:
|
|
|
|
|
|
* 1. 设置路由的meta属性为{ cache: true },表示需要缓存
|
|
|
|
|
|
* 2. App.vue中使用RouteCache组件,通过路由的name来进行匹配
|
|
|
|
|
|
* 3. 路由的name默认是文件名,如果文件名与name不一致,通过defineOptions({ name: 'componentName' })来设置
|
|
|
|
|
|
*/
|
|
|
|
|
|
const router = createRouter({
|
|
|
|
|
|
history: createWebHistory('/'),
|
|
|
|
|
|
// history: createWebHistory(import.meta.env.VITE_APP_URL),
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
{
|
|
|
|
|
|
path: '/',
|
2026-02-06 15:42:57 +08:00
|
|
|
|
name:'award',
|
|
|
|
|
|
component:()=>import('@/views/AwardPage/container.vue'),
|
|
|
|
|
|
children:[
|
|
|
|
|
|
{
|
|
|
|
|
|
path:'',
|
|
|
|
|
|
name:'AwardIndex',
|
|
|
|
|
|
component:()=>import('@/views/AwardPage/index.vue'),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
path:'contestants',
|
|
|
|
|
|
component:()=>import('@/views/AwardPage/apply.vue')
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2026-02-06 15:10:17 +08:00
|
|
|
|
},
|
2026-02-06 15:42:57 +08:00
|
|
|
|
|
2026-02-06 15:10:17 +08:00
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
path: '/:pathMatch(.*)',
|
|
|
|
|
|
name: '404',
|
|
|
|
|
|
component: () => import('../views/404.vue')
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
export default router
|