代码如图所示
var selectClick = new ol.interaction.Select({
condition: ol.events.condition.click,
multi: true,
});
map.addInteraction(selectClick);
selectClick.on('select', function(e) {
if(e.selected.length>0){
console.log(e.selected[0].N.attributes.ID)
}
});
效果是这样的,