【发布时间】:2018-04-20 13:11:50
【问题描述】:
这是我在 StackOverflow 上的第一个问题。
我目前正在使用 jsPlumb 来制作一种图表。图表的每个节点都可以有多个输入和输出,因此我在每个端点上标记并放置了一个 uuid:
jsPlumb.addEndpoint("name of node",
{
anchor : [0,0.75,-1,0],
overlays : [ ["Label", {label : "name of input", uuid : "name of input", location : [3.5,0.5]}] ]
}, targetEndpointOptions);
然后我尝试使用此函数获取端点的标签或 uuid:
function getConnexions()
{
var connected = jsPlumb.getConnections();
$.each(connected, function(id, connection)
{
console.log(connection.source);
console.log(connection.target);
console.log(connection.endpoints[0].getUuid());
$.each(connection.endpoints, function(id, endpoint)
{
console.log(endpoint.getLabel());
})
})
}
如您所见,我尝试了两种不同的方法来处理标签和 uuid。但这不起作用,我在控制台中得到 undefined 或 null 。有人可以帮忙吗?
非常感谢
【问题讨论】:
-
嗨@user9674896。我通常会编辑第一篇文章,但在你的情况下 - 没有必要这样做。第一个问题的格式很好。欢迎使用 StackOverflow,祝你好运!
标签: javascript jsplumb