From 6b9eee7fc6c9d6779a44bb50e7cafa173bb86d5c Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sat, 13 Apr 2024 19:31:07 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=BF=80=E6=B4=BB=E7=9A=84=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E7=9A=84=E6=89=80=E6=9C=89=E5=AD=90=E8=8A=82=E7=82=B9=E5=90=8E?= =?UTF-8?q?,=E5=B1=95=E5=BC=80=E6=94=B6=E8=B5=B7=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=B6=88=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index eaec8d8d..ffbc12b4 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -572,9 +572,10 @@ class Node { } this.updateNodeActiveClass() let { alwaysShowExpandBtn } = this.mindMap.opt + const childrenLength = this.nodeData.children.length if (alwaysShowExpandBtn) { // 需要移除展开收缩按钮 - if (this._expandBtn && this.nodeData.children.length <= 0) { + if (this._expandBtn && childrenLength <= 0) { this.removeExpandBtn() } else { // 更新展开收起按钮 @@ -583,7 +584,9 @@ class Node { } else { let { isActive, expand } = this.getData() // 展开状态且非激活状态,且当前鼠标不在它上面,才隐藏 - if (expand && !isActive && !this._isMouseenter) { + if (childrenLength <= 0) { + this.removeExpandBtn() + } else if (expand && !isActive && !this._isMouseenter) { this.hideExpandBtn() } else { this.showExpandBtn()