From a74a20049a4a75208f16a2a786d1e44bf040bdbe Mon Sep 17 00:00:00 2001 From: iqudoo Date: Mon, 25 May 2026 11:03:58 +0800 Subject: [PATCH] fix --- src/App.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index b6d6dc7..02ba0ae 100644 --- a/src/App.vue +++ b/src/App.vue @@ -797,7 +797,7 @@ v-model="showExportDrawer" title="导出文档" direction="rtl" - size="480px" + :size="exportDrawerSize" class="export-drawer" >
@@ -970,6 +970,7 @@ const currentApi = ref(null); const apiDetail = ref(null); const searchQuery = ref(""); const isMobile = ref(false); +const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 800); const showMenu = ref(false); const currentPath = ref([]); // 当前路径,用于记录层级 const currentPathKeys = ref([]); // 当前路径的key数组 @@ -990,6 +991,10 @@ const exportTreeProps = { const hostUrl = ref(import.meta.env.VITE_API_URL || "/api"); const showExportDrawer = ref(false); +const exportDrawerSize = computed(() => { + if (isMobile.value) return "100%"; + return `${Math.min(800, windowWidth.value)}px`; +}); // 监听搜索,如果有搜索则自动返回根级别显示所有匹配结果 watch(searchQuery, (newVal) => { @@ -1228,7 +1233,8 @@ const goToApi = (api) => { }; const checkDeviceType = () => { - isMobile.value = window.innerWidth <= 768; + windowWidth.value = window.innerWidth; + isMobile.value = windowWidth.value <= 768; showMenu.value = !isMobile.value; };