当前位置: 首页 > news >正文

vue使用x6画流程图,简单使用

官网
https://x6.antv.antgroup.com/tutorial/getting-started

安装
npm install @antv/x6 --save

使用

<template><div>3333<div id="container" style="width: 800px;height: 800px;"></div></div>
</template>
<script>
import { Graph } from '@antv/x6'
export default {data() {return {}},computed: {},mounted() {const data = {nodes: [{id: 'node1',shape: 'rect',x: 40,y: 40,width: 100,height: 40,label: 'hello',attrs: {// body 是选择器名称,选中的是 rect 元素body: {stroke: '#8f8f8f',strokeWidth: 1,fill: '#fff',rx: 6,ry: 6,},},},{id: 'node2',shape: 'rect',x: 160,y: 180,width: 100,height: 40,label: 'world',attrs: {body: {stroke: '#8f8f8f',strokeWidth: 1,fill: '#fff',rx: 6,ry: 6,},},},],edges: [{shape: 'edge',source: 'node1',target: 'node2',label: 'x6',attrs: {// line 是选择器名称,选中的边的 path 元素line: {stroke: '#8f8f8f',strokeWidth: 1,},},},],}const graph = new Graph({container: document.getElementById('container'),width: 800,height: 600,background: {color: '#F2F7FA',},})graph.fromJSON(data) // 渲染元素graph.centerContent() // 居中显示},methods: {}
};
</script>
<style></style>

2、一个一个节点添加

<template><div style="margin: 10px;"><el-button size="mini"  @click="rowclick('/#/new/purchase/request?background=1','请购单')">请购单</el-button><el-button size="mini"  @click="rowclick('/#/new/purchase/purchaseplan?background=1','采购计划单')">采购计划单</el-button><el-button size="mini"  @click="rowclick('/#/new/purchase/order?background=1','采购订单')">采购订单</el-button><div id="container"></div></div>
</template><script>import { Graph } from '@antv/x6'export default {props:['win'],data() {return {};},mounted() {//画布const graph = new Graph({container: document.getElementById('container'),width: 800,height: 600,background: {color: '#F2F7FA',},})//节点1graph.addNode({id: 'node1',shape: 'rect',label: 'hello',x: 100,y: 40,width: 100,height: 40,attrs: {// body 是选择器名称,选中的是 rect 元素body: {stroke: '#8f8f8f',strokeWidth: 1,fill: '#fff',rx: 6,ry: 6,},},})//节点2graph.addNode({id: 'node2',shape: 'rect',label: 'hello',x: 100,y: 100,width: 100,height: 40,attrs: {// body 是选择器名称,选中的是 rect 元素body: {stroke: '#8f8f8f',strokeWidth: 1,fill: '#fff',rx: 6,ry: 6,},},})//节点1连接节点2graph.addEdge({shape: 'edge',source: 'node1',target: 'node2',attrs: {// line 是选择器名称,选中的边的 path 元素line: {stroke: '#8f8f8f',strokeWidth: 1,},},})graph.centerContent() // 居中显示},methods: {//点击rowclick(id, path, name){this.win(id,path,name);},}};</script>
</script><style>
</style>

在这里插入图片描述

http://www.lryc.cn/news/402378.html

相关文章:

  • 低代码中间件学习体验分享:业务系统的创新引擎
  • 阿里云ACP云计算高级攻城狮通用知识
  • log4js node日志插件
  • 【MQTT(3)】开发一个客户端,QT-Android安卓手机版本
  • 大数据之数据抽取架构演变过程
  • [web]-反序列化-绕过__wakeup(转)
  • B树与B+树的区别
  • 机器人开源调度系统OpenTCS-6最新版本地源码运行
  • 云监控(华为) | 实训学习day3(10)
  • springMVC前后端请求参数绑定和传递
  • 【iOS】—— 消息传递和消息转发
  • 【Node.js】初识 Node.js
  • AWS backup服务和 RDS snapshot的关系
  • PDF转Word怎么快速转换?格式转换技巧分享
  • 浅谈:网络协议及网络连接
  • websocket-react使用
  • 【总结】nginx源码编译安装报错./configure: error: SSL modules require the OpenSSL library.
  • 昇思25天学习打卡营第15天|两个分类实验
  • 实践:Redis6.0配置文件解读
  • 【Go系列】Go语言的网络服务
  • CS110L(Rust)
  • 免费恢复软件有哪些?电脑免费使用的 5 大数据恢复软件
  • Flink History Server配置
  • ASPICE过程改进原则:确保汽车软件开发的卓越性能
  • HDU1005——Number Sequence,HDU1006——Tick and Tick,HDU1007——Quoit Design
  • uniapp form表单校验
  • 构建RSS订阅机器人:观察者模式的实践与创新
  • 芯片基础 | `wire`类型引发的学习
  • 如何在AWS上构建Apache DolphinScheduler
  • Quartus II 13.1添加新的FPGA器件库