From e6c92d4a5ed5302210788491fa32b2e397f2ad81 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sun, 8 Oct 2023 15:45:32 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=8D=8F?= =?UTF-8?q?=E5=90=8C=E7=BC=96=E8=BE=91=E6=97=B6=E4=BF=AE=E6=94=B9=E5=90=8C?= =?UTF-8?q?=E7=BA=A7=E8=8A=82=E7=82=B9=E7=9A=84=E4=BD=8D=E7=BD=AE=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=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/plugins/Cooperate.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/simple-mind-map/src/plugins/Cooperate.js b/simple-mind-map/src/plugins/Cooperate.js index d72377ab..6e33d6a7 100644 --- a/simple-mind-map/src/plugins/Cooperate.js +++ b/simple-mind-map/src/plugins/Cooperate.js @@ -293,14 +293,16 @@ class Cooperate { map[uid] = node } if (parentUid) { - if (map[parentUid]) { - map[parentUid].children.push(node) - } else { + const index = data[parentUid].children.findIndex(item => { + return item === uid + }) + if (!map[parentUid]) { map[parentUid] = { data: simpleDeepClone(data[parentUid].data), - children: [node] + children: [] } } + map[parentUid].children[index] = node } }) return res