//name为自定义数据
const {
status,
name
} = this.type && this.type.data
let circle2 = new this.fabric.Circle({
// width: 800,
// height: 400,
radius: 24,
scaleX: _this.scale,
scaleY: _this.scale,
stroke: '#fff',
strokeWidth: 2,
fill: "#191919",
left: offsetX / zoom - width * rate / 2 + moveDelta.x,
top: offsetY / zoom - height * rate / 2 + moveDelta.y
})
_this.newObj = new this.fabric.Group([circle2, imgInstance], {
left,
top,
name,
})
把自定义数据 放在Group对象里
通过事件 读取e.target.name即可获取自定义数据