This commit is contained in:
X1627315083
2025-10-21 13:47:41 +08:00
17 changed files with 1311 additions and 207 deletions

View File

@@ -1,4 +1,13 @@
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),
@@ -25,7 +34,7 @@ const router = createRouter({
{
path: '/stylist',
name: 'StylistPage',
redirect:'/stylist/index',
redirect: '/stylist/index',
component: () => import('@/views/stylist/container.vue'),
children: [
{
@@ -53,7 +62,8 @@ const router = createRouter({
{
path: '/asistant',
name: 'asistant',
component: () => import('../views/asistant/index.vue')
component: () => import('../views/asistant/index.vue'),
meta: { cache: true }
},
{
path: '/workshop',
@@ -61,8 +71,8 @@ const router = createRouter({
component: () => import('../views/Workshop/index.vue'),
children: [
{
path: '/workshop',
redirect: "/workshop/selectStyle",
path: '/workshop',
redirect: '/workshop/selectStyle'
},
{
path: '/workshop/selectStyle',
@@ -95,20 +105,20 @@ const router = createRouter({
// 自定义创作
path: '/workshop/customize',
name: 'customize',
component: () => import('../views/Workshop/customize.vue'),
component: () => import('../views/Workshop/customize.vue')
},
{
// library
path: '/workshop/library',
name: 'library',
component: () => import('../views/Workshop/library.vue'),
name: 'library',
component: () => import('../views/Workshop/library.vue')
},
{
// creation
path: '/workshop/creation',
name: 'creation',
component: () => import('../views/Workshop/creation/index.vue')
},
{
// creation
path: '/workshop/creation',
name: 'creation',
component: () => import('../views/Workshop/creation/index.vue'),
},
{
// 完成创建
path: '/workshop/end',