From 02c1d4c88c48f8f6fbe9aa395d190d332414d2be Mon Sep 17 00:00:00 2001
From: Next <1406099478@qq.com>
Date: Sun, 17 Jul 2022 18:23:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/TreePanel.vue | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/components/TreePanel.vue b/src/components/TreePanel.vue
index b0f8b9f..09d11bf 100644
--- a/src/components/TreePanel.vue
+++ b/src/components/TreePanel.vue
@@ -4,16 +4,13 @@
class="modal-drag">
节点树
-
-
- {{ node.label }}
-
-
+ :expand-on-click-node="false" :default-expanded-keys="expandedKeys" @current-change="handleCurrentNodeChange"
+ @node-expand="handleNodeExpand" @node-collapse="handleNodeCollapse" :height="treeViewHeight">
+
+ {{ node.label }}
+
+
@@ -76,8 +73,7 @@ function getChildByUuidPath(node: any, path: string[], index: number): any {
return getChildByUuidPath(node, path, index + 1);
}
-function handleCurrentNodeChange(data: TreeNode) {
- console.log(data);
+function handleCurrentNodeChange(data: any) {
// @ts-ignore
const ccNode = getChildByUuidPath(cc.director.getScene(), data.path, 0);
if (data) {
@@ -87,12 +83,12 @@ function handleCurrentNodeChange(data: TreeNode) {
}
}
-function handleNodeExpand(data: TreeNode) {
+function handleNodeExpand(data: any) {
expandedNodeMap.set(data.uuid, true);
expandedKeys = [...expandedNodeMap.keys()];
}
-function handleNodeCollapse(data: TreeNode) {
+function handleNodeCollapse(data: any) {
expandedNodeMap.delete(data.uuid);
expandedKeys = [...expandedNodeMap.keys()];
}