【问题标题】:How to add number to port in GoJS?如何在 GoJS 中向端口添加数字?
【发布时间】:2019-03-15 20:37:10
【问题描述】:

您好,我需要为每个端口添加编号,如下图所示。 附言。我如何在此站点上寻找解决问题 https://gojs.net/latest/intro/ports.html 并使用 portIdTextBlock 检查解决方案,但它不起作用:/

【问题讨论】:

    标签: javascript gojs


    【解决方案1】:

    您正在使用 Shape 作为端口,但任何 GoJS 对象都可以是端口,并且您确实想使用具有 Shape 和 TextBlock 作为端口的面板(自动面板)。

    我建议你阅读:https://gojs.net/latest/intro/buildingObjects.html

    【讨论】:

      【解决方案2】:

      您好,谢谢您的回答 :) 嗯,我尝试使用面板,但没有看到变化:/ 我做错了什么?

      this.$(go.Panel, 'Horizontal',
        new go.Binding('itemArray', 'bottomArray'),
        {
          row: 2, column: 1,
          itemTemplate:
            this.$(go.Panel, 'Vertical',
              {
                _side: 'bottom',
                fromSpot: go.Spot.Bottom, toSpot: go.Spot.Bottom, fromMaxLinks: 1,
                fromLinkable: true, toLinkable: false, cursor: 'pointer'
              },
              new go.Binding('portId', 'portId'),
      
              this.$(go.Shape, 'RoundedRectangle',
                {
                  stroke: null, strokeWidth: 0,
                  desiredSize: portSize,
                  margin: new go.Margin(2, 1, 0, 1)
                },
                new go.Binding('fill', 'portColor')),
              this.$(go.TextBlock,
                new go.Binding('text', 'name'))
            )
        }
      ),
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-22
        • 1970-01-01
        • 1970-01-01
        • 2020-04-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多