刷新gojs,控制台报错
<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");
.......
.......
}