1.前端代码

new Vue({

el: '#app',

data: {

},

mounted() {

this.init()

},

methods: {

init() {

axios.get(site_url + "topo/").then(res => {

if (res.data.result){

$('#bktopo_demo .bktopo_box').bkTopology({

data: res.data.data, //配置数据源

lineType:[ //配置线条的类型

{type:'success',lineColor:'#46C37B'},

{type:'info',lineColor:'#4A9BFF'},

{type:'warning',lineColor:'#f0a63a'},

{type:'danger',lineColor:'#c94d3c'},

{type:'default',lineColor:'#aaa'}

]

});

}else{

this.$message.error('获取拓朴数据失败');

}

},'json');

}

}

})

2.后端代码

def topo(request):

data = {

"nodes": [

{

"id": "demo3_node1", "x": 100, "y": 50, "height": 50,

"width": 100, "text": "发起", "className": "node success"

},

{

"id": "demo3_node2", "x": 250, "y": 50, "height": 50,

"width": 100, "text": "过程1", "className": "node success"

},

{

"id": "demo3_node3", "x": 400, "y": 50, "height": 50,

"width": 100, "text": "过程2", "className": "node danger"

},

{

"id": "demo3_node4", "x": 550, "y": 50, "height": 50,

"width": 100, "text": "过程3", "className": "node success"

},

{

"id": "demo3_node5", "x": 550, "y": 150, "height": 50,

"width": 100, "text": "过程4", "className": "node success"

},

{

"id": "demo3_node6", "x": 400, "y": 150, "height": 50,

"width": 100, "text": "过程5", "className": "node warning"

},

{

"id": "demo3_node7", "x": 250, "y": 150, "height": 50,

"width": 100, "text": "过程6", "className": "node success"

},

{

"id": "demo3_node8", "x": 100, "y": 150, "height": 50,

"width": 100, "text": "过程7", "className": "node success"

},

],

"edges": [

{

"source": "demo3_node1", "sDirection": 'right',

"target": "demo3_node2", "tDirection": 'left', "edgesType": "success"

},

{

"source": "demo3_node2", "sDirection": 'right',

"target": "demo3_node3", "tDirection": 'left', "edgesType": "danger"

},

{

"source": "demo3_node3", "sDirection": 'right',

"target": "demo3_node4", "tDirection": 'left', "edgesType": "success"

},

{

"source": "demo3_node4", "sDirection": 'right',

"target": "demo3_node5", "tDirection": 'right', "edgesType": "success"

},

{

"source": "demo3_node5", "sDirection": 'right',

"target": "demo3_node6", "tDirection": 'right', "edgesType": "warning"

},

{

"source": "demo3_node6", "sDirection": 'right',

"target": "demo3_node7", "tDirection": 'right', "edgesType": "success"

},

{

"source": "demo3_node7", "sDirection": 'right',

"target": "demo3_node8", "tDirection": 'right', "edgesType": "success"

},

]

}

return JsonResponse({"result": True, "data": data})

显示效果

vue 拓扑组件_vue.js生成S型拓扑图相关推荐

  1. vue 拓扑组件_Vue 集成 vis-network 实现网络拓扑图的方法_心病_前端开发者

    vis. https://visjs.org/ vs  code 下安装命令 npm install vis-network 在 const vis = require("vis-netwo ...

  2. vue 幻灯片组件_vue.js的幻灯片组件

    vue 幻灯片组件 Vue幻灯片放映 (vue-slideshows) a slideshow component for vue.js. vue.js的幻灯片组件. 安装 (Installation ...

  3. vue伸缩效果_Vue.js - 元素展开、收起动画效果组件(附:二级菜单的展开、收缩动画效果)...

    子菜单的展开.收缩功能在许多系统上都很常见,如果想要在打开收起时带有动画效果,过去常常会通过 jQuery 实现.而在 Vue 项目中,我们可以单独封装一个动画组件,方便使用. 1,效果图 点击一级菜 ...

  4. vue父组件变量传递子组件_Vue.js 父组件向子组件传递数据通过 props

    我的使用场景:父组件:home.vue 子组件:feed-section.vue 父组件 home.vue 通过请求拿到数据后,传递给子组件 feed-section.vue:因为在子组件中需要渲染 ...

  5. vue 动态路由_Vue.js应用性能优化三

    在上一篇Vue.js应用性能优化二中,我们学习了足够强大的模式,可以显着提高应用程序的性能 - 按照路由分割代码.虽然按照路由拆分代码非常有用,但在用户访问我们的站点后,仍然有很多内部代码不需要.在本 ...

  6. vue手风琴组件_Vue 2的Badger手风琴组件

    vue手风琴组件 Vue-Badger手风琴 (vue-badger-accordion) Badger-Accordion Component for Vue 2.0. Vue 2.0的Badge- ...

  7. web前端:原生多棱柱/无限棱柱组件,js生成元素,随机生成旋转角度transform

    1.less * {margin: 0;padding: 0;//注意防止页面下来body {height: 100%;overflow: hidden;#wrap {position: absolu ...

  8. vue图片裁剪组件_Vue.js图像裁剪组件

    vue图片裁剪组件 Vuejs夹 (vuejs-clipper) Vue.js image clipping components using Vue-Rx. 使用Vue-Rx的Vue.js图像裁剪组 ...

  9. vue vuex 挂载_vue.js,javascript_Vuex的初始化失败,一直显示没有挂载到根组件上,奇怪了!,vue.js,javascript - phpStudy...

    Vuex的初始化失败,一直显示没有挂载到根组件上,奇怪了! 代码如下 import 'babel-polyfill' import Vue from 'vue' import VueRouter fr ...

最新文章

  1. 实现对学生信息的修改操作
  2. JavaScript 对象的遍历以及判断方法
  3. 贝叶斯分类器期望损失函数理解及衍生的全新理解
  4. Java与C#比较,哪个语言更是适合你?
  5. 【XAduio2】6.如何枚举音频设备
  6. FutureTask使用
  7. 连号区间数(2013年第四届c/c++ b组第10题)
  8. [转]Design Pattern Interview Questions - Part 2
  9. python常用代码_Python常用算法学习(3)(原理+代码)——最全总结
  10. context的使用
  11. 万能搜索监控ip工具_录像机搜不到摄像头IP可能是以下原因
  12. 封装JDBC—非框架开发必备的封装类
  13. 开发ASP.NET下的MP3小偷程序
  14. python能做什么工作-python能做哪方面的工作
  15. Visual Studio.NET 无法创建或打开应用程序之解决方法
  16. VFP基础教程 2.8 使用命令建立和操作索引文件
  17. MySQL卸载与安装
  18. 完整的Java软件开发学习路线
  19. springboot 解决 woff2、ttf 跨域无法解析问题
  20. RocketMQ Topic是如何注册和保存的

热门文章

  1. 微软正式宣布 Win10 死刑,Win11 LTSC要来了
  2. python3爬虫爬取百度贴吧下载图片
  3. 基于php网吧会员管理系统-计算机毕业设计
  4. 淘宝运营 店铺动销率的定义 、公示解说、产生原因以及对应的解决方案
  5. 加入一个组播组过程分析
  6. 怎么测试t470p性能软件,ThinkPad T470p 助力耐热极限测试圆满完成
  7. 中国剩余定理 及 拓展中国剩余定理模板
  8. 如何通过微信裂变做营销?
  9. MAC版本Mysql数据库忘记密码解决教程
  10. 疫情过后,哪些互联网行业将迎来发展机遇