perf: 当浏览器窗口的可视区域小于或等于1280时隐藏页宽

This commit is contained in:
xiaoxian521
2024-03-23 08:19:37 +08:00
parent 97f167825d
commit 51ef3647fc
4 changed files with 18 additions and 2 deletions

View File

@@ -387,7 +387,7 @@ onUnmounted(() => removeMatchMedia);
</li>
</ul>
<span v-if="device !== 'mobile'">
<span v-if="useAppStoreHook().getViewportWidth > 1280">
<p :class="['mt-5', pClass]">页宽</p>
<Segmented
class="mb-2 select-none"

View File

@@ -89,7 +89,8 @@ let isAutoCloseSidebar = true;
useResizeObserver(appWrapperRef, entries => {
if (isMobile) return;
const entry = entries[0];
const [{ inlineSize: width }] = entry.borderBoxSize;
const [{ inlineSize: width, blockSize: height }] = entry.borderBoxSize;
useAppStoreHook().setViewportSize({ width, height });
width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout);
/** width app-wrapper类容器宽度
* 0 < width <= 760 隐藏侧边栏