From 4a7bd83835fa6bef90ea3ed765c9d0215ff7a705 Mon Sep 17 00:00:00 2001 From: cfq Date: Mon, 26 Jan 2026 14:06:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(FileTree):=20=E6=94=B9=E8=BF=9B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=A0=91=E4=BA=A4=E4=BA=92=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复目录加载逻辑,避免空数组误判为已加载 - 改进新建/重命名操作的父目录路径计算 - 为文件树节点添加悬停提示和主题样式适配 - 在工具栏添加设置按钮 - 扩展主题系统以支持暗色模式 --- public/preload/services.js | 3 +- src/components/FileTree.vue | 76 +++++++++++++++++++++++++++++++------ src/components/Toolbar.vue | 4 ++ src/composables/useTheme.js | 19 +++++++++- 4 files changed, 88 insertions(+), 14 deletions(-) diff --git a/public/preload/services.js b/public/preload/services.js index acacbef..410a872 100644 --- a/public/preload/services.js +++ b/public/preload/services.js @@ -49,7 +49,8 @@ window.services = { name: item.name, path: path.join(dirPath, item.name), type: item.isDirectory() ? "directory" : "file", - children: item.isDirectory() ? [] : undefined, // 目录初始化为空数组,标记为可展开 + // children 不设置或设为 undefined,表示未加载;如果设为 [],组件会认为已加载且为空 + children: undefined, })); } catch (error) { console.error("读取目录失败:", error); diff --git a/src/components/FileTree.vue b/src/components/FileTree.vue index a63cf93..ce676c2 100644 --- a/src/components/FileTree.vue +++ b/src/components/FileTree.vue @@ -21,7 +21,7 @@ >