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 = [] -}