未捕获的TypeError:el.target不是Cytoscape中的函数

时间:2018-11-03 03:09:56

标签: cytoscape.js

在cytoscape js中,标题为“ images-breadthfirst-layout”的示例 (Angular Update Guide

cy.on('tap', 'node', function(){
var nodes = this;
var tapped = nodes;
var food = [];

nodes.addClass('eater');

for(;;){
  var connectedEdges = nodes.connectedEdges(function(el){   <-- here
    return !el.target().anySame( nodes );
});

运行此示例时,我在chrome中遇到此错误:

code.js:106 Uncaught TypeError: el.target is not a function
    at a.<anonymous> (code.js:106)
    at s.filter (cytoscape.min.js:18)
    at a.connectedEdges (cytoscape.min.js:18)
    at a.<anonymous> (code.js:105)
    at u.<anonymous> (cytoscape.min.js:19)
    at a.<anonymous> (cytoscape.min.js:19)
    at t (cytoscape.min.js:21)
    at cytoscape.min.js:21

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

请确保从download Cytoscape only from the master branch或npm开始。同样,请确保使用demo code only from the master branch

文档仅链接到master分支。