From 7f77c7f6f3145303187f90a2ed204a3e28603828 Mon Sep 17 00:00:00 2001 From: Jasery Date: Fri, 31 Oct 2025 10:49:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(CreateTemplateScreen):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=B1=95=E5=BC=80/=E6=94=B6=E8=B5=B7=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=8A=9F=E8=83=BD=E5=8F=8A=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除不再使用的展开/收起全部按钮及其相关函数,简化组件逻辑 --- src/renderer/screens/CreateTemplateScreen.vue | 62 ++----------------- 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/src/renderer/screens/CreateTemplateScreen.vue b/src/renderer/screens/CreateTemplateScreen.vue index d29f2c4..c52ece3 100644 --- a/src/renderer/screens/CreateTemplateScreen.vue +++ b/src/renderer/screens/CreateTemplateScreen.vue @@ -107,34 +107,7 @@ 添加根文件 - - mdi-arrow-expand-down - - 展开全部 - - - - mdi-arrow-collapse-up - - 收起全部 - - + { } } - // Expand all nodes by default - nextTick(() => { - expandAll() - }) + }) onUnmounted(() => { @@ -405,10 +375,7 @@ const handleDirectoryDialogConfirm = (data: { path: string; fullPath: string }) parentDirectoryForNewItems.value = null // Clear parent context after creation currentEditingItem.value = null - // After adding a new directory, expand all nodes to show the new structure - nextTick(() => { - expandAll() - }) + } // 在树状结构中更新节点的辅助函数 @@ -551,10 +518,7 @@ const handleFileDialogConfirm = (data: { path: string; fullPath: string; sourceF parentDirectoryForNewItems.value = null // Clear parent context after creation currentEditingItem.value = null - // After adding a new file, expand all nodes to show the new structure - nextTick(() => { - expandAll() - }) + } // 检查树中是否有重复路径的辅助函数 @@ -593,25 +557,7 @@ const goBack = async () => { } } -const expandAll = () => { - const allIds: string[] = [] - const collectIds = (items: TreeItem[]) => { - items.forEach((item) => { - if (item.children && item.children.length > 0) { - allIds.push(item.id) - collectIds(item.children) - } - }) - } - - collectIds(treeItems.value) - expandedNodes.value = allIds -} - -const collapseAll = () => { - expandedNodes.value = [] -}