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) { 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) {