网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

怎么在vue中利用vis-network实现网络拓扑图-创新互联

本篇文章为大家展示了怎么在vue中利用vis-network 实现网络拓扑图,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

为红山等地区用户提供了全套网页设计制作服务,及红山网站建设行业解决方案。主营业务为成都网站设计、成都网站制作、外贸网站建设、红山网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

vs  code 下安装命令

npm install vis-network

在vue  下引入 vis-network组件

const vis = require("vis-network/dist/vis-network.min.js");
require("vis-network/dist/vis-network.min.css");

例子代码使用

let DIR = "/jtopo/";
let nodes = [
{ id: 1, shape: "circularImage", image: DIR + "server.png" },
{ id: 2, shape: "circularImage", image: DIR + "server.png" },
{ id: 3, shape: "circularImage", image: DIR + "server.png" },
{
id: 4,
shape: "circularImage",
image: DIR + "gather.png",
label: "pictures by this guy!"
},
{ id: 5, shape: "circularImage", image: DIR + "wanjet.png" },
{ id: 6, shape: "circularImage", image: DIR + "center.png" },
{ id: 7, shape: "circularImage", image: DIR + "cloud.png" },
{ id: 8, shape: "circularImage", image: DIR + "center.png" },
{ id: 9, shape: "circularImage", image: DIR + "wanjet.png" },
{ id: 10, shape: "circularImage", image: DIR + "gather.png" }
// { id: 11, shape: "circularImage", image: DIR + "11.png" },
// { id: 12, shape: "circularImage", image: DIR + "12.png" },
// { id: 13, shape: "circularImage", image: DIR + "13.png" },
// { id: 14, shape: "circularImage", image: DIR + "14.png" },
// {
// id: 15,
// shape: "circularImage",
// image: DIR + "missing.png",
// brokenImage: DIR + "missingBrokenImage.png",
// label: "when images\nfail\nto load"
// },
// {
// id: 16,
// shape: "circularImage",
// image: DIR + "anotherMissing.png",
// brokenImage: DIR + "9.png",
// label: "fallback image in action"
// }
];
let edges = [
{ from: 1, to: 4 },
{ from: 2, to: 4 },
{ from: 3, to: 4 },
{ from: 4, to: 5 },
{ from: 5, to: 6 },
{ from: 6, to: 7 },
{ from: 8, to: 7 },
{ from: 9, to: 8 },
{ from: 10, to: 9 }
// { from: 8, to: 10 },
// { from: 10, to: 11 },
// { from: 11, to: 12 },
// { from: 12, to: 13 },
// { from: 13, to: 14 },
// { from: 9, to: 16 }
];
for (let i = 1; i <= 100; i++) {
num = i + 10;
nodes.push({
id: num,
label: num.toString()
});
edges.push({ from: num, to: 10 });
}
let data = {
nodes: nodes,
edges: edges
};
let container = document.getElementById("mynetwork");
//let options = {};
let options = {
nodes: {
font: {
color: "white", //字体的颜色
size: 30 //显示字体大小
},
scaling: {
min: 16,
max: 32 //缩放效果比例
},
borderWidth: 0,
color: {
border: "white",
background: "white" //若是引用图标,背景颜色
}
},
groups: {
ws: {
//系统定义的形状 dot等 这些官网都可以找到
shape: "dot",
color: "white"
}
},
edges: {
//连接线的样式
color: {
color: "white",
highlight: "white",
hover: "#848484",
inherit: "from",
opacity: 1.0
}
},
layout: {
randomSeed: 1 //配置每次生成的节点位置都一样,参数为数字1、2等
},
physics: {
// barnesHut: { gravitationalConstant: -30000 },
barnesHut: {
gravitationalConstant: -80000,
springConstant: 0.001,
springLength: 200
},
stabilization: false
//{ iterations: 2500 }
},
interaction: {
// navigationButtons: true,
hover: true, //鼠标移过后加粗该节点和连接线
selectConnectedEdges: false, //选择节点后是否显示连接线
hoverConnectedEdges: false, //鼠标滑动节点后是否显示连接线
tooltipDelay: 200,
zoomView: true //是否能缩放画布
},
edges: {
shadow: true, //连接线阴影配置
smooth: true //是否显示方向箭头
// arrows: {to : true }//箭头指向from节点
}
};
that.network = new vis.Network(container, data, options);
that.network.on("click", function(params) {});

vue是什么

Vue是一套用于构建用户界面的渐进式JavaScript框架,Vue与其它大型框架的区别是,使用Vue可以自底向上逐层应用,其核心库只关注视图层,方便与第三方库和项目整合,且使用Vue可以采用单文件组件和Vue生态系统支持的库开发复杂的单页应用。

上述内容就是怎么在vue中利用vis-network 实现网络拓扑图,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注创新互联成都网站设计公司行业资讯频道。

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享标题:怎么在vue中利用vis-network实现网络拓扑图-创新互联
当前路径:http://bjjierui.cn/article/pjjhg.html

其他资讯