<template>
<div id="myDiagramDiv" style="width: 100%; height: 800px"></div>
</template>
<script>
import go from "gojs";
export default {
name: "GoJsDiagram",
mounted() {
console.log("图表图表图白哦");
const $ = go.GraphObject.make;
const myDiagram = $(go.Diagram, "myDiagramDiv", {
"undoManager.isEnabled": true,
});
myDiagram.nodeTemplate = $(
go.Node,
"Auto",
$(
go.Shape,
"RoundedRectangle",
{ strokeWidth: 0 },
new go.Binding("fill", "color")
),
$(go.TextBlock, { margin: 8 }, new go.Binding("text", "key"))
);
myDiagram.linkTemplate = $(
go.Link,
$(go.Shape),
$(go.Shape, { toArrow: "Standard" })
);
const model = $(go.GraphLinksModel);
model.nodeDataArray = [
{ key: "Alpha", color: "lightblue" },
{ key: "Beta", color: "orange" },
];
model.linkDataArray = [{ from: "Alpha", to: "Beta" }];
myDiagram.model = model;
},
};
</script>
<style>
/* 在这里添加额外的 CSS 样式 */
</style>
vue gojs流程图插件报错index.js:513 ReferenceError: Super constructor may only be called once,有什么解决办法?求助
最新推荐文章于 2024-08-16 23:32:06 发布