diff --git a/src/design/global.less b/src/design/global.less index 034d08905..323ff114c 100644 --- a/src/design/global.less +++ b/src/design/global.less @@ -26,11 +26,11 @@ } .justify-start { - justify-content: start; + justify-content: flex-start; } .justify-end { - justify-content: end; + justify-content: flex-end; } .justify-around { diff --git a/src/layouts/default/header/LayoutHeader.tsx b/src/layouts/default/header/LayoutHeader.tsx index d695b86de..89022ebf9 100644 --- a/src/layouts/default/header/LayoutHeader.tsx +++ b/src/layouts/default/header/LayoutHeader.tsx @@ -1,6 +1,6 @@ import './index.less'; -import { defineComponent, unref, computed, ref } from 'vue'; +import { defineComponent, unref, computed, ref, nextTick } from 'vue'; import { Layout, Tooltip, Badge } from 'ant-design-vue'; import { AppLogo } from '/@/components/Application'; @@ -39,8 +39,8 @@ export default defineComponent({ setup() { let logoEl: Element | null; - const widthRef = ref(200); - + const logoWidthRef = ref(200); + const logoRef = ref(null); const { refreshPage } = useTabs(); const { getShowTopMenu, getShowHeaderTrigger, getSplit, getTopMenuAlign } = useMenuSetting(); @@ -64,15 +64,17 @@ export default defineComponent({ useWindowSizeFn( () => { - if (!unref(getShowTopMenu)) return; - let width = 0; - if (!logoEl) { - logoEl = document.querySelector('.layout-header__logo'); - } - if (logoEl) { - width += logoEl.clientWidth; - } - widthRef.value = width + 60; + nextTick(() => { + if (!unref(getShowTopMenu)) return; + let width = 0; + if (!logoEl) { + logoEl = logoRef.value.$el; + } + if (logoEl) { + width += logoEl.clientWidth; + } + logoWidthRef.value = width + 80; + }); }, 200, { immediate: true } @@ -105,11 +107,11 @@ export default defineComponent({ } function renderHeaderContent() { - const width = unref(widthRef); + const width = unref(logoWidthRef); return (
{unref(getShowHeaderLogo) && ( - + )} {unref(getShowContent) && ( diff --git a/src/layouts/default/header/index.less b/src/layouts/default/header/index.less index c50059547..44abeff63 100644 --- a/src/layouts/default/header/index.less +++ b/src/layouts/default/header/index.less @@ -12,7 +12,7 @@ &__left { display: flex; - flex-grow: 1; + // flex-grow: 1; align-items: center; .layout-trigger { @@ -184,7 +184,7 @@ } &__menu { - margin-left: 20px; + margin-left: 4px; overflow: hidden; align-items: center; }