我简单的写了一个设置图片的功能,您可以参考这个功能在项目里进行修改,通过得到的feature去设置他的点图层样式
map.on('click', function (e) { map.forEachFeatureAtPixel(e.pixel, function (feature) { vectorTileStyles.dispatchEvent({type: 'featureSelected', selectedId: feature.getProperties().id, layerName: feature.getProperties().layerName }); return true; }, {hitTolerance: 5}); map.forEachFeatureAtPixel(e.pixel, function (feature) { console.log(feature.getProperties()); if(feature.getProperties().type == "POINT"){ feature.setStyle(iconStyle); } return true; }, {hitTolerance: 5}); vectorLayer.changed(); })