From c62ee071f6099ec553d524b2ef52b2f133216211 Mon Sep 17 00:00:00 2001 From: wangnaiyi Date: Mon, 10 Feb 2025 11:26:16 +0800 Subject: [PATCH] =?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) {