当前位置: 首页 > 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>

在这里插入图片描述

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 鸿蒙语言基础类库:【@system.request (上传下载)】
  • 分布式搜索引擎ES-Elasticsearch进阶
  • Python酷库之旅-第三方库Pandas(032)
  • 食堂采购系统开发:从需求分析到上线实施的完整指南
  • npm install时报错 reason: connect ETIMEDOUT
  • 网络安全-等级保护制度介绍
  • 使用AJAX发起一个异步请求,从【api_endpoint】获取数据,并在成功时更新页面上的【target_element】
  • 详细分析Java中的6种请求方式(附Demo)
  • WPF TreeView 全选/反选/子级选中父级也选中
  • 降低芯片流片风险的几种方法
  • 算法第十天:leetcode203.移除链表元素
  • 【C++】C++11的新特性 --- 右值引用与移动语义
  • 排序系列 之 选择排序
  • FastAPI -- 第三弹(自定义响应、中间件、代理、WebSockets)
  • 【Python 对接QQ的接口(三)】简单用接口查询【等级/昵称/头像/Q龄/状态/会员/当天在线时长/下一个等级升级需多少天】
  • [数据结构]链表的实现在PHP中
  • [译]如何构建服务器端web组件,为何要构建?
  • 【跃迁之路】【519天】程序员高效学习方法论探索系列(实验阶段276-2018.07.09)...
  • Computed property XXX was assigned to but it has no setter
  • Django 博客开发教程 16 - 统计文章阅读量
  • electron原来这么简单----打包你的react、VUE桌面应用程序
  • export和import的用法总结
  • leetcode388. Longest Absolute File Path
  • miaov-React 最佳入门
  • nginx 配置多 域名 + 多 https
  • Traffic-Sign Detection and Classification in the Wild 论文笔记
  • Twitter赢在开放,三年创造奇迹
  • Webpack 4 学习01(基础配置)
  • 从0实现一个tiny react(三)生命周期
  • 关于 Cirru Editor 存储格式
  • 使用前端开发工具包WijmoJS - 创建自定义DropDownTree控件(包含源代码)
  • 腾讯优测优分享 | Android碎片化问题小结——关于闪光灯的那些事儿
  • 延迟脚本的方式
  • 译自由幺半群
  • 自制字幕遮挡器
  • ​DB-Engines 12月数据库排名: PostgreSQL有望获得「2020年度数据库」荣誉?
  • #14vue3生成表单并跳转到外部地址的方式
  • #APPINVENTOR学习记录
  • #我与Java虚拟机的故事#连载09:面试大厂逃不过的JVM
  • (+3)1.3敏捷宣言与敏捷过程的特点
  • (libusb) usb口自动刷新
  • (ZT)北大教授朱青生给学生的一封信:大学,更是一个科学的保证
  • (八)五种元启发算法(DBO、LO、SWO、COA、LSO、KOA、GRO)求解无人机路径规划MATLAB
  • (待修改)PyG安装步骤
  • (转)创业的注意事项
  • ******之网络***——物理***
  • *算法训练(leetcode)第三十九天 | 115. 不同的子序列、583. 两个字符串的删除操作、72. 编辑距离
  • ./indexer: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object fil
  • .NET/C# 编译期能确定的字符串会在字符串暂存池中不会被 GC 垃圾回收掉
  • .NET/C# 中你可以在代码中写多个 Main 函数,然后按需要随时切换
  • .net网站发布-允许更新此预编译站点
  • @cacheable 是否缓存成功_Spring Cache缓存注解
  • [012-1].第12节:Mysql的配置文件的使用
  • [2019.2.28]BZOJ4033 [HAOI2015]树上染色
  • [boost]使用boost::function和boost::bind产生的down机一例