在jointJS中每个新创建的链接中,在这个链接上都有默认名称“Name”。我将如何将其更改为我自己的名字,例如 var test 的内容?
我的链接 javascript 代码如下:
//New Transition
this.paper = new joint.dia.Paper({
width: 1000,
height: 1000,
gridSize: 10,
model: this.graph,
defaultLink: new joint.dia.Link({
//Code alteration to mimic label functionality-adding labels:
attrs: {
'.marker-source': { d: 'M 10 0 L 0 5 L 10 10 z', transform: 'scale(0.001)' }, // scale(0)(0.001)' }, // scale(0) fails in Firefox
'.marker-target': { d: 'M 10 0 L 0 5 L 10 10 z' },
'.connection': { stroke: 'black' }
},
router: { name: 'manhattan' },
labels:[
{ position: 0.5, attrs: { text: { text: 'Name' } } }
]
}),