如何在 cy 外部获取我的元素数据以进行事件

How to get my element data outside cy for event

本文关键字:数据 事件 元素 我的 cy 外部 获取      更新时间:2023-09-26

如何在cy函数之外访问元素节点数据? 这是我的代码:

function cytoFunc(myJson){
var cy = window.cy = cytoscape({
    container: document.getElementById('cy'),
       // style
       // elements
}); // end of cy
cy.$('node').qtip({
  content: 'I want to insert element data here',
  position: {
    my: 'left center',
    at: 'bottom center'
  },
  style: {
    classes: 'qtip-bootstrap',
    tip: {
      width: 16,
      height: 8
    }
  }
}); // end of cy.qtip

}//细胞功能结束

如果需要每个元素的粒度,请对每个元素调用 qtip。 使用 .forEach() .