<div id="myDiagramDiv"></div>
import go from "gojs";
data() {
return {
myDiagram: null,
}
},
mounted() {
this.drawTopo();
},
method() {
drawTopo() {
const $ = go.GraphObject.make;
this.myDiagram = $(go.Diagram, "myDiagramDiv");
.......
.......
}
}
this.myDiagram.div = null;
drawTopo() {
const $ = go.GraphObject.make;
if (this.myDiagram) {
this.myDiagram.div = null; // 重新渲染时需清空div
}
this.myDiagram = $(go.Diagram, "myDiagramDiv");
.......
.......
}