vue2 antv x6 入门 (三) 连接桩
注册节点
Graph.registerNode( 'custom-node-width-port', { inherit: 'rect', width: 100, height: 40, attrs: { body: { stroke: '#8f8f8f', strokeWidth: 1, fill: '#fff', rx: 6, ry: 6, }, }, ports: { groups: { top: { position: 'top', attrs: { circle: { magnet: true, stroke: '#8f8f8f', r: 5, }, }, }, bottom: { position: 'bottom', attrs: { circle: { magnet: true, stroke: '#8f8f8f', r: 5, }, }, }, }, }, }, true, )
使用节点
const source = graph.addNode({ shape: 'custom-node-width-port', x: 40, y: 40, label: 'hello', ports: { items: [ { id: 'port_1', group: 'bottom', }, { id: 'port_2', group: 'bottom', }, ], }, })
浙公网安备 33010602011771号