通过如下代码,无法通过for循环为每一个marker注册click事件。请问如何解决。官网的demo都已经看过了,没有用的
function createMarker(obj,iconPath){
for(var i=0;i<100;i++){
addMarkers(obj,i,iconPath)
}
}
function addMarkers(obj,idx,iconPath) {
let _this = this
let size = new SuperMap.Size(20, 20);
let offset = new SuperMap.Pixel(-(size.w / 2), -size.h);
let icon = new SuperMap.Icon(iconPath, size, offset);
markerRR = new SuperMap.Marker(new SuperMap.LonLat(obj.Longitude,obj.Latitude), icon);
SuperMap.LonLat(obj.Longitude,obj.Latitude), icon);
_this.vehMarkers.addMarker(markerRR);
markerRR.events.on({
"click": _this.comonPupop(obj),
"scope": markerRR
});
},