0x0 IntroductionBecause the project uses flowcharts and the requirements are not detailed, the more flexible x6 graphic editor is chosen as the flowchart editor. From the documentation, it is not complicated, so this is just a reference tutorial. Antv X6 Documentation 0x1 InstallationInstall the x6 dependency according to the tutorial instructions, and then create a new container for instantiation: <div ref="containerRef" class="area-center-container" /> const data = { // Nodes: [ { id: 'node1', // String, optional, unique identifier of the node x: 40, // Number, required, x value of the node position y: 40, // Number, required, y value of the node position width: 80, // Number, optional, width value of the node size height: 40, // Number, optional, height value of the node size label: 'hello', // String, node label }, { id: 'node2', // String, unique identifier of the node x: 160, // Number, required, x value of the node position y: 180, // Number, required, y value of the node position width: 80, // Number, optional, width value of the node size height: 40, // Number, optional, height value of the node size label: 'world', // String, node label }, ], // edges: [ { source: 'node1', // String, required, starting node id target: 'node2', // String, required, target node id }, ], } function initGraph() { const graph = new Graph({ container: this.$refs.containerRef, grid: { size: 10, // grid size 10px visible: true // render mesh background}, snapline: enabled: true, // Alignment sharp: true }, scroller: enabled: true, pageVisible: false, pageBreak: false, pannable: true } }) // Center the canvas graph.centerContent() graph.fromJSON(data) } This is the simplest example. Please refer to the corresponding explanations in the documentation for the different parameters above. 0x2 Node SidebarAccording to the stencil example in the document, a lot of code can be simplified. You can just use the encapsulated business directly. Just write a container instantiation as above: <el-aside ref="stencilRef" class="area-left" /> this.stencil = new Stencil({ title: 'Process Node Sidebar', target: graph, search: false, collapsable: true, stencilGraphWidth: this.$refs.stencilRef.$el.clientWidth, stencilGraphHeight: this.$refs.stencilRef.$el.clientHeight, groups: [ { name: 'group', title: 'Flowchart Node', collapsable: false } ], getDropNode: node => { let cloneNode = node.clone() switch (node.shape) { case 'rect': cloneNode = new RectShape() break case 'circle': cloneNode = new CircleShape() break case 'polygon': cloneNode = new PolylineShape() break } cloneNode.updateInPorts(graph) return cloneNode } }) // Load nodes this.stencil.load([new Rect(rectInfo), new Circle(circleInfo), new Polygon(polygonInfo)], 'group') 0x3 Integration ExampleOnline: https://codesandbox.io/s/icy-meadow-rqihx The above is the details of the example steps of using Antv X6 with Vue.js. For more information about using Antv X6 with Vue.js, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Upgrade Docker version of MySQL 5.7 to MySQL 8.0.13, data migration
>>: About MySQL 8.0.13 zip package installation method
Table of contents Preface 1. Routing lazy loading...
This article example shares the specific code of ...
Table of contents 1. Home Page Production 1. Prod...
Table of contents 1. Overview 2. Memory Managemen...
Under the instructions of my leader, I took over ...
background This bug was caused by滾動條占據空間. I check...
Element form and code display For details, please...
It is also very simple to deploy Django projects ...
Preface The Windows system that can be activated ...
1. Software Introduction VirtualBox VirtualBox is...
This article shares the specific code for impleme...
Recently, WeChat Mini Program has proposed adjust...
Table of contents 1. Filter unique values 2. Shor...
I have been learning porters recently. I feel lik...
Messy log Nginx in daily use is mostly used as bo...