分类 ui 下的文章

应用场景:

  • 在vue 中使用
  • data(){
      return{
        network:{}
      }
    }
  • this.network = new vis.Network(container, data, options);

问题表现: setData 方法不报错,但是它导致所有的节点都显示同样的label 值。
问题解决:

this.network = new vis.Network(container, data, options); 

官网
http://visjs.org/
基本使用示例

// create an array with nodes
var nodes = new vis.DataSet([
    {id: 1, label: 'Node 1'},
    {id: 2, label: 'Node 2'},
    {id: 3, label: 'Node 3'},
    {id: 4, label: 'Node 4'},
    {id: 5, label: 'Node 5'}
]);

// create an array with edges
var edges = new vis.DataSet([
    {from: 1, to: 3},
    {from: 1, to: 2},
    {from: 2, to: 4},
    {from: 2, to: 5}
]);

// create a network
var container = document.getElementById('mynetwork');
var data = {
    nodes: nodes,
    edges: edges
};
var options = {};
var network = new vis.Network(container, data, options);