Update FileManager.vue

This commit is contained in:
Baobhan Sith
2025-04-30 00:03:14 +08:00
parent be845c2d9f
commit af2cea0be7
@@ -126,7 +126,8 @@ const isSearchActive = ref(false); // 新增:控制搜索框激活状态
const searchInputRef = ref<HTMLInputElement | null>(null); // 新增:搜索输入框 ref const searchInputRef = ref<HTMLInputElement | null>(null); // 新增:搜索输入框 ref
const pathInputRef = ref<HTMLInputElement | null>(null); const pathInputRef = ref<HTMLInputElement | null>(null);
const editablePath = ref(''); const editablePath = ref('');
const fileListContainerRef = ref<HTMLDivElement | null>(null); // 文件列表容器引用 (保留,传递给 Composable) const fileListContainerRef = ref<HTMLDivElement | null>(null); // 文件列表容器引用
const dropOverlayRef = ref<HTMLDivElement | null>(null); // +++ 新增:拖拽蒙版引用 +++
// const scrollIntervalId = ref<number | null>(null); // 已移至 useFileManagerDragAndDrop // const scrollIntervalId = ref<number | null>(null); // 已移至 useFileManagerDragAndDrop
// +++ 新增:剪贴板状态 +++ // +++ 新增:剪贴板状态 +++
@@ -923,6 +924,25 @@ onBeforeUnmount(() => {
sessionStore.removeSftpManager(props.sessionId, props.instanceId); 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 getColumnKeyByIndex = (index: number): keyof typeof colWidths.value | null => {
const keys = Object.keys(colWidths.value) as Array<keyof typeof colWidths.value>; const keys = Object.keys(colWidths.value) as Array<keyof typeof colWidths.value>;
@@ -1276,6 +1296,7 @@ defineExpose({ focusSearchInput, startPathEdit });
<!-- 新增外部文件拖拽蒙版 --> <!-- 新增外部文件拖拽蒙版 -->
<div <div
v-if="showExternalDropOverlay" v-if="showExternalDropOverlay"
ref="dropOverlayRef"
class="absolute inset-0 flex items-center justify-center bg-black/70 text-white text-xl font-semibold rounded z-50 pointer-events-auto" class="absolute inset-0 flex items-center justify-center bg-black/70 text-white text-xl font-semibold rounded z-50 pointer-events-auto"
@dragover.prevent @dragover.prevent
@dragleave.prevent="handleDragLeave" @dragleave.prevent="handleDragLeave"