JS Plumb连接功能不接受参数

时间:2020-03-24 06:01:12

标签: javascript reactjs jsplumb

console.error()

我已经在jsplumb connect函数中传递了该对象,它的行为与预期的方式不同,我想调整线条和箭头的宽度吗?

更新: 我尝试使用端点的uuid进行连接,也首先要添加端点的uuid,然后再尝试连接它们,并同时控制uuid和端点的同一个uuid,但仍然获取源不存在错误。enter image description here

1 个答案:

答案 0 :(得分:0)

对我来说是这样的

let e1 = instance.addEndpoint("src", {
  endpoint: ["Dot", { radius: 5,  cssClass:"hasInfluencedEndpointStrong" }], 
  anchor: "Center", 
  paintStyle: { 
    width: 25, 
    height: 21, 
    fill:"transparent"
  }, 
  scope: "hasInfluencedStrong", 
  isSource: true, 
  reattach: true,
  maxConnections: -1, 
  connectorStyle: { 
    stroke: "#708088", 
    strokeWidth: 2.6, 
    outlineStroke: "transparent", 
    outlineWidth: 4 
  }, 
  connectorOverlays:[ 
    [ "Arrow", { location: -15.5, id: "arrow", length: 14, width:14, foldback: 1, direction:1 } ] 
  ]
});

let e2 = instance.addEndpoint("target", {
  endpoint: ["Dot", { radius: 5,  cssClass:"hasInfluencedEndpointStrong" }], 
  anchor: "Center", 
  paintStyle: { 
    width: 25, 
    height: 21, 
    fill:"transparent"
  }, 
  scope: "hasInfluencedStrong", 
  isTarget: true, 
  reattach: true,
  maxConnections: -1, 
  connectorStyle: { 
    stroke: "#708088", 
    strokeWidth: 2.6, 
    outlineStroke: "transparent", 
    outlineWidth: 4 
  }, 
  connectorOverlays:[ 
    [ "Arrow", { location: -15.5, id: "arrow", length: 14, width:14, foldback: 1, direction:1 } ] 
  ]
});

,然后连接这些端点:

instance.connect({
  source:e1,
  target:e2
});