diff --git a/package.json b/package.json index 333cb4047..cac33208f 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,8 @@ "@antv/data-set": "^0.11.8", "@antv/g2": "^4.2.5", "@better-scroll/core": "^2.4.2", - "@soybeanjs/vue-admin-layout": "^1.0.6", - "@soybeanjs/vue-admin-tab": "^1.0.3", + "@soybeanjs/vue-admin-layout": "^1.1.1", + "@soybeanjs/vue-admin-tab": "^1.0.5", "@vueuse/core": "^8.9.1", "axios": "^0.27.2", "clipboard": "^2.0.11", @@ -46,7 +46,7 @@ "form-data": "^4.0.0", "lodash-es": "^4.17.21", "naive-ui": "^2.31.0", - "pinia": "^2.0.14", + "pinia": "^2.0.15", "print-js": "^1.6.0", "qs": "^6.11.0", "swiper": "^8.3.0", @@ -105,7 +105,7 @@ "vite-plugin-mock": "^2.9.6", "vite-plugin-svg-icons": "^2.0.1", "vue-eslint-parser": "^9.0.3", - "vue-tsc": "^0.38.4" + "vue-tsc": "^0.38.5" }, "homepage": "https://github.com/honghuangdc/soybean-admin", "repository": { diff --git a/src/composables/layout.ts b/src/composables/layout.ts index 27cfc53ff..b60d1b331 100644 --- a/src/composables/layout.ts +++ b/src/composables/layout.ts @@ -1,4 +1,5 @@ import { computed } from 'vue'; +import { useBreakpoints, breakpointsTailwind } from '@vueuse/core'; import { useAppStore, useThemeStore } from '@/store'; type LayoutMode = 'vertical' | 'horizontal'; @@ -7,6 +8,7 @@ type LayoutHeaderProps = Record; export function useBasicLayout() { const app = useAppStore(); const theme = useThemeStore(); + const breakpoints = useBreakpoints(breakpointsTailwind); const mode = computed(() => { const vertical: LayoutMode = 'vertical'; @@ -14,6 +16,8 @@ export function useBasicLayout() { return theme.layout.mode.includes(vertical) ? vertical : horizontal; }); + const isMobile = breakpoints.smaller('sm'); + const layoutHeaderProps: LayoutHeaderProps = { vertical: { showLogo: false, @@ -61,6 +65,7 @@ export function useBasicLayout() { return { mode, + isMobile, headerProps, siderVisible, siderWidth, diff --git a/src/layouts/BasicLayout/index.vue b/src/layouts/BasicLayout/index.vue index f09a7096f..e9e0baa00 100644 --- a/src/layouts/BasicLayout/index.vue +++ b/src/layouts/BasicLayout/index.vue @@ -1,7 +1,7 @@