我正在尝试将每个图像上的数组的值设置为'id'
var pics = ["http://konvajs.github.io/assets/lion.png", "http://konvajs.github.io/assets/monkey.png"];
var imgID = ["73", "70"];
// Count total items in array
var count = 0;
pics.forEach(function() {
count++;
});
for(var l = 0; l < count; l++) {
var src = pics[l];
// create new Konva.Image from src attribute
Konva.Image.fromURL(src, function(image) {
image.setAttrs({
draggable: true,
id: imgID[l],
x: Math.random() * stage.width(),
y: Math.random() * stage.height(),
});