From b3d33600c0b91cc987465ed3c2d81824ce98e5b6 Mon Sep 17 00:00:00 2001 From: renxiaodong <1344903914@qq.com> Date: Sun, 22 Jun 2025 22:52:03 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0hideSidebar=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/Basic.vue | 15 ++++++++------- src/router/index.ts | 9 ++++++--- src/router/typeings.d.ts | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/layouts/Basic.vue b/src/layouts/Basic.vue index 565347c..3ef29d9 100644 --- a/src/layouts/Basic.vue +++ b/src/layouts/Basic.vue @@ -3,11 +3,13 @@ import { useAppStore } from '@/stores'; import { useResponsive } from '@/hooks'; import JoinModal from '@/components/join-modal.vue'; import { getQueryParam } from '@/utils/helper'; -import { ref, onMounted } from 'vue'; +import { ref, onMounted, computed } from 'vue'; +import { useRoute } from 'vue-router'; const joinEnterpriseVisible = ref(false); const appStore = useAppStore(); const router = useRouter(); +const route = useRoute(); useResponsive(true); const navbarHeight = `60px`; @@ -26,11 +28,10 @@ const paddingStyle = computed(() => { const paddingTop = navbar.value ? { paddingTop: navbarHeight } : {}; return { ...paddingLeft, ...paddingTop }; }); -const showSidebar = ref(false); -const route = useRoute(); -// onMounted(() => { -// showSidebar.value = route.meta.requiresSidebar == true; -// }); +const showSidebar = computed(() => { + return !(route.meta && route.meta.hideSidebar); +}); + onMounted(() => { checkHasInviteCode(); }); @@ -62,7 +63,7 @@ provide('toggleDrawerMenu', () => { import('@/views/components/login'), }, { path: '/workplace', name: 'workplace', component: () => import('@/views/components/workplace'), + meta: { + hideSidebar: true, + }, }, { path: '/', - name: 'Home', + name: 'dataEngine', redirect: '/dataEngine/dataEngine/hotTranslation', children: [...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE], }, diff --git a/src/router/typeings.d.ts b/src/router/typeings.d.ts index c4f4179..09da67d 100644 --- a/src/router/typeings.d.ts +++ b/src/router/typeings.d.ts @@ -3,7 +3,7 @@ import { RouteComponent } from 'vue-router'; declare module 'vue-router' { interface RouteMeta { roles?: string[]; // Controls roles that have access to the page - requiresAuth: boolean; // Whether login is required to access the current page (every route must declare) + requiresAuth?: boolean; // Whether login is required to access the current page (every route must declare) icon?: RouteComponent; // The icon show in the side menu locale?: string; // The locale name show in side menu and breadcrumb needNavigate?: boolean; // if set true, the breadcrumb will support navigate @@ -13,5 +13,6 @@ declare module 'vue-router' { order?: number; // Sort routing menu items. If set key, the higher the value, the more forward it is noAffix?: boolean; // if set true, the tag will not affix in the tab-bar ignoreCache?: boolean; // if set true, the page will not be cached + hideSidebar?: boolean; } }