From 7533599cac981c8acf443b9b9ac7423e456d9e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Thu, 26 Dec 2024 18:25:16 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8DcopyNodeTree?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=96=B9=E6=B3=95=E5=85=8B=E9=9A=86=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=AF=B9=E8=B1=A1=E7=9A=84=E6=95=B0=E6=8D=AE=E6=97=B6?= =?UTF-8?q?=E4=BC=9A=E6=8A=8A=E8=8A=82=E7=82=B9=E5=AE=9E=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B9=9F=E5=85=8B=E9=9A=86=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/utils/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/simple-mind-map/src/utils/index.js b/simple-mind-map/src/utils/index.js index b9a3ed9f..019b1955 100644 --- a/simple-mind-map/src/utils/index.js +++ b/simple-mind-map/src/utils/index.js @@ -190,7 +190,8 @@ export const copyNodeTree = ( removeActiveState = false, removeId = true ) => { - tree.data = simpleDeepClone(root.nodeData ? root.nodeData.data : root.data) + const rootData = root.nodeData ? root.nodeData : root + tree.data = simpleDeepClone(rootData.data) // 移除节点uid if (removeId) { delete tree.data.uid @@ -216,9 +217,9 @@ export const copyNodeTree = ( }) } // data、children外的其他字段 - Object.keys(root).forEach(key => { + Object.keys(rootData).forEach(key => { if (!['data', 'children'].includes(key) && !/^_/.test(key)) { - tree[key] = root[key] + tree[key] = rootData[key] } }) return tree @@ -1005,6 +1006,7 @@ export const createUidForAppointNodes = ( createNewId = false, handle = null ) => { + console.log(appointNodes) const walk = list => { list.forEach(node => { if (!node.data) {