首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法为另一个函数获取特定值

无法为另一个函数获取特定值
EN

Stack Overflow用户
提问于 2019-06-08 00:29:55
回答 1查看 38关注 0票数 0

我的工作是使逻辑电路使用盖茨和多路复用使用javascript和GoJS。我想获取一个特定的输入端口值,并在另一个函数中使用它

代码语言:javascript
复制
      var multiplexarTemplate =
      $(go.Node, "Spot", nodeStyle(),
      $(go.Shape, "Rectangle",  { width: 50, height: 80, margin: 4, 
      fill: "lightgray",  stroke: "darkslategray", strokeWidth: 2 
      }), 
      $(go.Shape, "Rectangle", portStyle(true),
        { portId: "in1", alignment: new go.Spot(0, 0.2) }),
      $(go.Shape, "Rectangle", portStyle(true),
        { portId: "in2", alignment: new go.Spot(0, 0.4) }),
      $(go.Shape, "Rectangle", portStyle(true),
        { portId: "in3", alignment: new go.Spot(0, 0.6) }),  
      $(go.Shape, "Rectangle", portStyle(true),
        { portId: "in4", alignment: new go.Spot(0, 0.8) }),
      $(go.Shape, "Rectangle", portStyle(true),
        { portId: "in5", alignment: new go.Spot(0.3, 1) }),
      $(go.Shape, "Rectangle", portStyle(true),
        { portId: "in6", alignment: new go.Spot(0.65, 1) }),
        $(go.Shape, "Rectangle", portStyle(false),
        { portId: "out", alignment: new go.Spot(1, 0.5) }) 
       )

在本例中,我想特别获取in1,并在另一个函数中使用它。以同样的方式,我也想获得in2,in3,in4,并在另一个函数中使用它,但我不能弄清楚如何做到这一点。

EN

回答 1

Stack Overflow用户

发布于 2019-06-08 01:11:07

使用Node.findPorthttps://gojs.net/latest/api/symbols/Node.html#findPort

代码语言:javascript
复制
var in2 = someNode.findPort('in2');
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56498155

复制
相关文章

相似问题

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