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
How to use CSS to control the arc movement of ele...
I always feel that designers are the most sensiti...
When I was taking a break, a phone call completel...
Table of contents The dynamic particle effects ar...
What is DNS The full name of DNS is Domain Name S...
Preface Recently, I encountered a requirement at ...
JSON data is displayed and formatted on the HTML ...
MySQL 5.7 version: Method 1: Use the SET PASSWORD...
It is almost a standard feature for websites nowa...
<br />Sometimes you may be asked questions l...
1. Basic Specifications (1) InnoDB storage engine...
1. Element time selection submission format conve...
Table of contents 1. Demand 2. Database Design 3....
In our recent project, we need to use Google robo...
On the server, in order to quickly log in to the ...