feat: 增加hideSidebar配置

This commit is contained in:
renxiaodong
2025-06-22 22:52:03 -04:00
parent 2ce531f896
commit b3d33600c0
3 changed files with 16 additions and 11 deletions

View File

@ -3,11 +3,13 @@ import { useAppStore } from '@/stores';
import { useResponsive } from '@/hooks'; import { useResponsive } from '@/hooks';
import JoinModal from '@/components/join-modal.vue'; import JoinModal from '@/components/join-modal.vue';
import { getQueryParam } from '@/utils/helper'; 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 joinEnterpriseVisible = ref(false);
const appStore = useAppStore(); const appStore = useAppStore();
const router = useRouter(); const router = useRouter();
const route = useRoute();
useResponsive(true); useResponsive(true);
const navbarHeight = `60px`; const navbarHeight = `60px`;
@ -26,11 +28,10 @@ const paddingStyle = computed(() => {
const paddingTop = navbar.value ? { paddingTop: navbarHeight } : {}; const paddingTop = navbar.value ? { paddingTop: navbarHeight } : {};
return { ...paddingLeft, ...paddingTop }; return { ...paddingLeft, ...paddingTop };
}); });
const showSidebar = ref(false); const showSidebar = computed(() => {
const route = useRoute(); return !(route.meta && route.meta.hideSidebar);
// onMounted(() => { });
// showSidebar.value = route.meta.requiresSidebar == true;
// });
onMounted(() => { onMounted(() => {
checkHasInviteCode(); checkHasInviteCode();
}); });
@ -62,7 +63,7 @@ provide('toggleDrawerMenu', () => {
<a-layout> <a-layout>
<a-layout> <a-layout>
<a-layout-sider <a-layout-sider
v-if="renderMenu" v-if="renderMenu && showSidebar"
v-show="!hideMenu" v-show="!hideMenu"
class="layout-sider" class="layout-sider"
breakpoint="xl" breakpoint="xl"

View File

@ -2,7 +2,7 @@
* @Author: 田鑫 * @Author: 田鑫
* @Date: 2023-03-05 18:14:17 * @Date: 2023-03-05 18:14:17
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @LastEditTime: 2025-06-20 05:35:27 * @LastEditTime: 2025-06-22 22:46:01
* @Description: * @Description:
*/ */
import { createRouter, createWebHistory } from 'vue-router'; import { createRouter, createWebHistory } from 'vue-router';
@ -20,17 +20,20 @@ const router = createRouter({
routes: [ routes: [
{ {
path: '/login', path: '/login',
name: 'UserLogin', name: 'login',
component: () => import('@/views/components/login'), component: () => import('@/views/components/login'),
}, },
{ {
path: '/workplace', path: '/workplace',
name: 'workplace', name: 'workplace',
component: () => import('@/views/components/workplace'), component: () => import('@/views/components/workplace'),
meta: {
hideSidebar: true,
},
}, },
{ {
path: '/', path: '/',
name: 'Home', name: 'dataEngine',
redirect: '/dataEngine/dataEngine/hotTranslation', redirect: '/dataEngine/dataEngine/hotTranslation',
children: [...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE], children: [...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE],
}, },

View File

@ -3,7 +3,7 @@ import { RouteComponent } from 'vue-router';
declare module 'vue-router' { declare module 'vue-router' {
interface RouteMeta { interface RouteMeta {
roles?: string[]; // Controls roles that have access to the page 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 icon?: RouteComponent; // The icon show in the side menu
locale?: string; // The locale name show in side menu and breadcrumb locale?: string; // The locale name show in side menu and breadcrumb
needNavigate?: boolean; // if set true, the breadcrumb will support navigate 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 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 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 ignoreCache?: boolean; // if set true, the page will not be cached
hideSidebar?: boolean;
} }
} }