Files
Aida_Purchaser_Front/src/router/index.ts

63 lines
1.5 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({
2026-04-22 10:30:55 +08:00
routes: [
{
path: '/',
name: 'home',
component: () => import('../views/home/index.vue')
},
{
path: '/collectionStory',
name: 'collectionStory',
component: () => import('../views/collectionStory/index.vue')
2026-04-22 10:43:40 +08:00
},
{
path: '/brand',
name: 'brand',
component: () => import('../views/brand/index.vue')
2026-04-22 10:30:55 +08:00
},
{
path: '/digitalItem',
name: 'digitalItem',
component: () => import('../views/digitalItem/index.vue'),
},
2026-04-22 10:30:55 +08:00
{
path: '/settings',
name: 'settings',
component: () => import('@/views/setting/index.vue'),
meta: { cache: true }
},
2026-04-23 11:48:22 +08:00
{
path: '/shoppingCart',// 购物车
name: 'shoppingCart',
component: () => import('@/views/shoppingCart/index.vue')
},
2026-04-23 09:39:12 +08:00
{
path: '/notifications',
name: 'notifications',
component: () => import('@/views/notifications/index.vue')
},
2026-04-22 10:30:55 +08:00
{
path: '/:pathMatch(.*)',
name: '404',
component: () => import('../views/404.vue')
}
2026-04-22 10:43:40 +08:00
],
history: createWebHistory('/')
2026-04-20 11:21:21 +08:00
})
router.beforeEach((to, from, next) => {
2026-04-22 10:30:55 +08:00
next()
2026-04-20 11:21:21 +08:00
})
2026-04-22 10:30:55 +08:00
router.afterEach(() => {})
2026-04-20 11:21:21 +08:00
export default router