如何将 id 添加到 konvajs 节点?

How do I add an id to a konvajs node?

我正在创建一组圆圈,我想遍历它们并根据某种标识符突出显示。

如果我可以设置 circle.id = 1, circle.id = 2, ...

就好了
// create circle
var circle = new Konva.Circle({
  radius: 40,
  fill: 'red',
  stroke: 'black',
  strokeWidth: 5
});

// set id
circle.id('foo');

// get id
var name = circle.id();

注:id = String类型,继承自Konva.Node#id

Link: https://konvajs.org/api/Konva.Circle.html#id__anchor