From b626f5a35b4e11db3ede2de9203bca6556e8102c Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Mon, 15 Sep 2025 14:54:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(layout):=20=E4=BC=98=E5=8C=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B8=83=E5=B1=80=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 App.vue 中使用 route.meta.withoutLayout 替代原有的 route.path 和 route.name判断逻辑 - 在 router/index.ts 和 materialCenter.ts 中为需要独立布局的路由添加 withoutLayout: true 标记 - 更新 router/typeings.d.ts,添加 withoutLayout属性定义 --- src/App.vue | 2 +- src/router/index.ts | 2 ++ src/router/routes/modules/materialCenter.ts | 2 ++ src/router/typeings.d.ts | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 036a5ba..5222b03 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@ diff --git a/src/router/index.ts b/src/router/index.ts index 27e95c5..94f266e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -22,6 +22,7 @@ export const router = createRouter({ meta: { requiresAuth: false, requireLogin: false, + withoutLayout: true, }, }, { @@ -50,6 +51,7 @@ export const router = createRouter({ meta: { requiresAuth: false, requireLogin: true, + withoutLayout: true, }, }, diff --git a/src/router/routes/modules/materialCenter.ts b/src/router/routes/modules/materialCenter.ts index 0f91eb1..e8cd94e 100644 --- a/src/router/routes/modules/materialCenter.ts +++ b/src/router/routes/modules/materialCenter.ts @@ -120,6 +120,7 @@ const COMPONENTS: AppRouteRecordRaw[] = [ requireLogin: false, hideFooter: true, hideSidebar: true, + withoutLayout: true, roles: ['*'], }, component: () => import('@/views/material-center/components/finished-products/explore/list/index.vue'), @@ -133,6 +134,7 @@ const COMPONENTS: AppRouteRecordRaw[] = [ requireLogin: false, hideFooter: true, hideSidebar: true, + withoutLayout: true, roles: ['*'], }, component: () => import('@/views/material-center/components/finished-products/explore/detail/index.vue'), diff --git a/src/router/typeings.d.ts b/src/router/typeings.d.ts index f64b2f6..1baa8f4 100644 --- a/src/router/typeings.d.ts +++ b/src/router/typeings.d.ts @@ -19,5 +19,6 @@ declare module 'vue-router' { requireLogin?: boolean; // 是否需要登陆才能访问 independent?: boolean; // 独立于layout的路由 group?: string; // 路由分组 + withoutLayout?: boolean; // 不使用layout,默认false } }