首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法使用jsPlumb获取端点的uuid或标签

无法使用jsPlumb获取端点的uuid或标签
EN

Stack Overflow用户
提问于 2018-04-20 21:11:50
回答 1查看 427关注 0票数 2

这是我在StackOverflow上的第一个问题。

我目前正在使用jsPlumb来制作一种图表。图中的每个节点可以有多个输入和输出,因此我在每个端点上标记并放置了一个uuid:

代码语言:javascript
复制
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:

代码语言:javascript
复制
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。但这不起作用,我在控制台中要么未定义,要么为null。有人能帮帮忙吗?

非常感谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-16 09:11:48

您已将uuid放在标签上,而不是放在端点上。如果您尝试将uuid放在端点上,请尝试:

代码语言:javascript
复制
jsPlumb.addEndpoint("name of node",
{
    anchor : [0,0.75,-1,0],
    uuid : "name of node",
    overlays : [ ["Label", {label : "name of input", location : [3.5,0.5]}] ]
}, targetEndpointOptions);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49942460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档