This commit is contained in:
One 2026-01-21 20:32:55 +00:00 committed by GitHub
commit 3ae6cca0a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -390,11 +390,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) {

View File

@ -46,6 +46,7 @@ export default {
methods: {
//
onDataChange(data) {
if (!data) return
this.textStr = ''
this.words = 0
this.num = 0
@ -56,7 +57,6 @@ export default {
//
walk(data) {
if (!data) return
this.num++
this.textStr += String(data.data.text) || ''
if (data.children && data.children.length > 0) {