From c62ee071f6099ec553d524b2ef52b2f133216211 Mon Sep 17 00:00:00 2001 From: wangnaiyi Date: Mon, 10 Feb 2025 11:26:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AF=BC=E5=87=BAxmind?= =?UTF-8?q?=E4=B8=8D=E5=85=BC=E5=AE=B9tag=E4=B8=BA=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把tag对象数组转换成字符串数组 --- simple-mind-map/src/plugins/Export.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/simple-mind-map/src/plugins/Export.js b/simple-mind-map/src/plugins/Export.js index bb57645bc..f14085c39 100644 --- a/simple-mind-map/src/plugins/Export.js +++ b/simple-mind-map/src/plugins/Export.js @@ -322,11 +322,28 @@ class Export { if (!this.mindMap.doExportXMind) { throw new Error('请注册ExportXMind插件') } - const data = this.mindMap.getData() + // const data = this.mindMap.getData() + const data = await this.changeTagObjToString(this.mindMap.getData()) const blob = await this.mindMap.doExportXMind.xmind(data, name) const res = await readBlob(blob) return res } + // 把tag对象数组转换成字符串数组 + async changeTagObjToString (treeObj) { + const tagArr = [] + if (treeObj.data.tag) { + await treeObj.data.tag.forEach(item => { + tagArr.push(item.text) + treeObj.data.tag = tagArr + }) + } else { + treeObj.data.tag = [] + } + await treeObj.children.forEach(child => { + this.changeTagObjToString(child) + }) + return treeObj + } // 导出为svg async svg(name) { From e0130f70045e3f6556dabeced6931ed371c708cd Mon Sep 17 00:00:00 2001 From: One Date: Tue, 25 Mar 2025 11:14:23 +0800 Subject: [PATCH 2/2] Update Count.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决刚进入脑图 Ctrl+Z操作导致数值全部归0的问题 --- web/src/pages/Edit/components/Count.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/pages/Edit/components/Count.vue b/web/src/pages/Edit/components/Count.vue index 2cde211b9..0118a1305 100644 --- a/web/src/pages/Edit/components/Count.vue +++ b/web/src/pages/Edit/components/Count.vue @@ -56,6 +56,7 @@ export default { * @Desc: 监听数据变化 */ onDataChange(data) { + if (!data) return this.textStr = '' this.words = 0 this.num = 0 @@ -70,7 +71,6 @@ export default { * @Desc: 遍历 */ walk(data) { - if (!data) return this.num++ this.textStr += String(data.data.text) || '' if (data.children && data.children.length > 0) {