Files
Aida_Purchaser_Front/src/router/index.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2026-04-20 11:21:21 +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: [
2026-04-20 14:02:55 +08:00
{
path: '/',
name: 'home',
component: () => import('../views/home/index.vue'),
},
2026-04-20 14:06:02 +08:00
{
path: '/collectionStory',
name: 'collectionStory',
component: () => import('../views/collectionStory/index.vue'),
},
2026-04-21 15:57:37 +08:00
{
path: '/brand',
name: 'brand',
component: () => import('../views/brand/index.vue'),
},
2026-04-20 11:21:21 +08:00
{
path: '/:pathMatch(.*)',
name: '404',
component: () => import('../views/404.vue'),
},
]
})
router.beforeEach((to, from, next) => {
next()
})
router.afterEach(() => {
})
export default router