From eee51966b98fc81dc3bb74a46d05ba63ff2ad26e Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Wed, 11 Mar 2020 20:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=96=87=E4=BB=B6=E5=A4=B9=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/src/editor/sidebar/ScriptPanel.jsx | 2 ++ ShadowEditor.Web/src/ui/tree/Tree.jsx | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ShadowEditor.Web/src/editor/sidebar/ScriptPanel.jsx b/ShadowEditor.Web/src/editor/sidebar/ScriptPanel.jsx index 27bb77e8..ef0cc24e 100644 --- a/ShadowEditor.Web/src/editor/sidebar/ScriptPanel.jsx +++ b/ShadowEditor.Web/src/editor/sidebar/ScriptPanel.jsx @@ -38,12 +38,14 @@ class ScriptPanel extends React.Component { return { value: n[0], text: `${n[1].name}.${this.getExtension(n[1].type)}`, + leaf: false, expanded: true }; } else { // 脚本 return { value: n[0], text: `${n[1].name}.${this.getExtension(n[1].type)}`, + leaf: true, icons: [{ name: 'edit', value: n[0], diff --git a/ShadowEditor.Web/src/ui/tree/Tree.jsx b/ShadowEditor.Web/src/ui/tree/Tree.jsx index 15e07eef..08ca19f0 100644 --- a/ShadowEditor.Web/src/ui/tree/Tree.jsx +++ b/ShadowEditor.Web/src/ui/tree/Tree.jsx @@ -47,11 +47,12 @@ class Tree extends React.Component { } createNode(data) { - const leaf = !data.children || data.children.length === 0; + // TODO: leaf应该根据数据上的left属性判断,而不是children。 + const leaf = (!data.children || data.children.length === 0) && data.leaf !== false; - const children = leaf ? null : : null; let checkbox = null;