From af2cea0be7f871626ed28ad5f37ec5de4a644208 Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Wed, 30 Apr 2025 00:03:14 +0800 Subject: [PATCH] Update FileManager.vue --- .../frontend/src/components/FileManager.vue | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/FileManager.vue b/packages/frontend/src/components/FileManager.vue index 0303e3b..bb98365 100644 --- a/packages/frontend/src/components/FileManager.vue +++ b/packages/frontend/src/components/FileManager.vue @@ -126,7 +126,8 @@ const isSearchActive = ref(false); // 新增:控制搜索框激活状态 const searchInputRef = ref(null); // 新增:搜索输入框 ref const pathInputRef = ref(null); const editablePath = ref(''); -const fileListContainerRef = ref(null); // 文件列表容器引用 (保留,传递给 Composable) +const fileListContainerRef = ref(null); // 文件列表容器引用 +const dropOverlayRef = ref(null); // +++ 新增:拖拽蒙版引用 +++ // const scrollIntervalId = ref(null); // 已移至 useFileManagerDragAndDrop // +++ 新增:剪贴板状态 +++ @@ -923,6 +924,25 @@ onBeforeUnmount(() => { sessionStore.removeSftpManager(props.sessionId, props.instanceId); }); +// +++ 新增:监听蒙版可见性,动态调整高度 +++ +watch(showExternalDropOverlay, (isVisible) => { + if (isVisible) { + nextTick(() => { // 确保 refs 可用且 scrollHeight 已计算 + if (dropOverlayRef.value && fileListContainerRef.value) { + const scrollHeight = fileListContainerRef.value.scrollHeight; + dropOverlayRef.value.style.height = `${scrollHeight}px`; + // console.log(`[FileManager ${props.sessionId}-${props.instanceId}] Overlay shown. Setting height to scrollHeight: ${scrollHeight}px`); + } + }); + } else { + // 蒙版隐藏时重置高度 + if (dropOverlayRef.value) { + dropOverlayRef.value.style.height = ''; // 移除内联样式 + // console.log(`[FileManager ${props.sessionId}-${props.instanceId}] Overlay hidden. Resetting height.`); + } + } +}); + // --- 列宽调整逻辑 (保持不变) --- const getColumnKeyByIndex = (index: number): keyof typeof colWidths.value | null => { const keys = Object.keys(colWidths.value) as Array; @@ -1276,6 +1296,7 @@ defineExpose({ focusSearchInput, startPathEdit });