|
@@ -71,7 +71,9 @@
|
|
import FlowGraph from '../../graph'
|
|
import FlowGraph from '../../graph'
|
|
import { DataUri } from '@antv/x6'
|
|
import { DataUri } from '@antv/x6'
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
-
|
|
|
|
|
|
+import { XMLBuilder, XMLParser } from 'fast-xml-parser'
|
|
|
|
+const builder = new XMLBuilder()
|
|
|
|
+const parser = new XMLParser()
|
|
const { graph } = FlowGraph
|
|
const { graph } = FlowGraph
|
|
const { history } = graph
|
|
const { history } = graph
|
|
|
|
|
|
@@ -193,6 +195,11 @@ function handleClick(event: Event) {
|
|
console.log(graph.toJSON())
|
|
console.log(graph.toJSON())
|
|
window.localStorage.setItem('graphJson', JSON.stringify(graph.toJSON()))
|
|
window.localStorage.setItem('graphJson', JSON.stringify(graph.toJSON()))
|
|
// graph.fromJSON({cells:[graph.toJSON().cells[0],graph.toJSON().cells[1]]})
|
|
// graph.fromJSON({cells:[graph.toJSON().cells[0],graph.toJSON().cells[1]]})
|
|
|
|
+ const xmlContent = builder.build(graph.toJSON())
|
|
|
|
+ window.localStorage.setItem('graphXML', xmlContent)
|
|
|
|
+ // 解析 XML
|
|
|
|
+ const jsonObj = parser.parse(xmlContent)
|
|
|
|
+ window.localStorage.setItem('jsonObj', JSON.stringify(jsonObj))
|
|
break
|
|
break
|
|
default:
|
|
default:
|
|
break
|
|
break
|