mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
Merge e0130f7004 into 9eab537b2e
This commit is contained in:
commit
3ae6cca0a0
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user