修复错误

This commit is contained in:
Next 2022-07-17 18:23:01 +08:00
parent 9f32e46f3f
commit 02c1d4c88c

View File

@ -4,16 +4,13 @@
class="modal-drag"> class="modal-drag">
节点树 节点树
</div> </div>
<!-- <div style="width: 100%;" :style="{ height: treeViewHeight }">
</div> -->
<el-tree-v2 ref="treeView" :props="defaultProps" empty-text="正在加载场景" :highlight-current="true" <el-tree-v2 ref="treeView" :props="defaultProps" empty-text="正在加载场景" :highlight-current="true"
:expand-on-click-node="false" :default-expanded-keys="expandedKeys" @current-change="handleCurrentNodeChange" :expand-on-click-node="false" :default-expanded-keys="expandedKeys" @current-change="handleCurrentNodeChange"
@node-expand="handleNodeExpand" @node-collapse="handleNodeCollapse" :height="treeViewHeight"> @node-expand="handleNodeExpand" @node-collapse="handleNodeCollapse" :height="treeViewHeight">
<template #default="{ node }"> <template #default="{ node }">
<span :class="{ 'node-hide': !node.data.active }">{{ node.label }}</span> <span :class="{ 'node-hide': !node.data.active }">{{ node.label }}</span>
</template> </template>
</el-tree-v2> </el-tree-v2>
<div style="width: 100%;border-top: 2px solid #1d1e21;overflow: auto;flex: 1;"> <div style="width: 100%;border-top: 2px solid #1d1e21;overflow: auto;flex: 1;">
<template v-if="updateKey !== 0 && Utils.checkNodeValid(currentNode)"> <template v-if="updateKey !== 0 && Utils.checkNodeValid(currentNode)">
<el-scrollbar> <el-scrollbar>
@ -76,8 +73,7 @@ function getChildByUuidPath(node: any, path: string[], index: number): any {
return getChildByUuidPath(node, path, index + 1); return getChildByUuidPath(node, path, index + 1);
} }
function handleCurrentNodeChange(data: TreeNode) { function handleCurrentNodeChange(data: any) {
console.log(data);
// @ts-ignore // @ts-ignore
const ccNode = getChildByUuidPath(cc.director.getScene(), data.path, 0); const ccNode = getChildByUuidPath(cc.director.getScene(), data.path, 0);
if (data) { if (data) {
@ -87,12 +83,12 @@ function handleCurrentNodeChange(data: TreeNode) {
} }
} }
function handleNodeExpand(data: TreeNode) { function handleNodeExpand(data: any) {
expandedNodeMap.set(data.uuid, true); expandedNodeMap.set(data.uuid, true);
expandedKeys = [...expandedNodeMap.keys()]; expandedKeys = [...expandedNodeMap.keys()];
} }
function handleNodeCollapse(data: TreeNode) { function handleNodeCollapse(data: any) {
expandedNodeMap.delete(data.uuid); expandedNodeMap.delete(data.uuid);
expandedKeys = [...expandedNodeMap.keys()]; expandedKeys = [...expandedNodeMap.keys()];
} }