refactor(CreateTemplateScreen): 移除展开/收起全部功能及相关代码
移除不再使用的展开/收起全部按钮及其相关函数,简化组件逻辑
This commit is contained in:
1 parent
ce849b8d66
commit
7f77c7f6f3
1 file changed
+4
-58
@@ -107,34 +107,7 @@
|
|||||||
添加根文件
|
添加根文件
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
|
||||||
icon
|
|
||||||
variant="text"
|
|
||||||
@click="expandAll"
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-arrow-expand-down</v-icon>
|
|
||||||
<v-tooltip
|
|
||||||
activator="parent"
|
|
||||||
location="bottom"
|
|
||||||
>
|
|
||||||
展开全部
|
|
||||||
</v-tooltip>
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
icon
|
|
||||||
variant="text"
|
|
||||||
@click="collapseAll"
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-arrow-collapse-up</v-icon>
|
|
||||||
<v-tooltip
|
|
||||||
activator="parent"
|
|
||||||
location="bottom"
|
|
||||||
>
|
|
||||||
收起全部
|
|
||||||
</v-tooltip>
|
|
||||||
</v-btn>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TemplateTree
|
<TemplateTree
|
||||||
@@ -287,10 +260,7 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand all nodes by default
|
|
||||||
nextTick(() => {
|
|
||||||
expandAll()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
@@ -405,10 +375,7 @@ const handleDirectoryDialogConfirm = (data: { path: string; fullPath: string })
|
|||||||
parentDirectoryForNewItems.value = null // Clear parent context after creation
|
parentDirectoryForNewItems.value = null // Clear parent context after creation
|
||||||
currentEditingItem.value = null
|
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
|
parentDirectoryForNewItems.value = null // Clear parent context after creation
|
||||||
currentEditingItem.value = null
|
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 = []
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user