From 1770cb98aae8772118f79538ba430a25eff2cfc3 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sat, 1 Feb 2025 11:28:25 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=E8=87=AA=E5=8A=A8=E7=BB=99=E6=B2=A1?= =?UTF-8?q?=E6=9C=89uid=E7=9A=84=E8=8A=82=E7=82=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0uid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 7976dcc5..072f293d 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -20,7 +20,8 @@ import { isUndef, handleGetSvgDataExtraContent, getNodeTreeBoundingRect, - mergeTheme + mergeTheme, + createUidForAppointNodes } from './src/utils' import defaultTheme, { checkIsNodeSizeIndependenceConfig @@ -149,6 +150,8 @@ class MindMap { if (data.data && !data.data.expand) { data.data.expand = true } + // 给没有uid的节点添加uid + createUidForAppointNodes([data], false, null, true) return data } @@ -395,6 +398,7 @@ class MindMap { // 更新画布数据,如果新的数据是在当前画布节点数据基础上增删改查后形成的,那么可以使用该方法来更新画布数据 updateData(data) { + data = this.handleData(data) this.emit('before_update_data', data) this.renderer.setData(data) this.render() @@ -583,7 +587,7 @@ class MindMap { this.watermark.isInExport = false } // 添加必要的样式 - [this.joinCss(), ...cssTextList].forEach(s => { + ;[this.joinCss(), ...cssTextList].forEach(s => { clone.add(SVG(``)) }) // 附加内容