📅  最后修改于: 2022-03-11 15:02:50.257000             🧑  作者: Mango
// markers saved here
var currentMarkers=[];
// tmp marker
var oneMarker= new mapboxgl.Marker(currentMarkerDiv)
.setLngLat(marker.geometry.coordinates)
.addTo(mapboxMap);
// save tmp marker into currentMarkers
currentMarkers.push(oneMarker);
// remove markers
if (currentMarkers!==null) {
for (var i = currentMarkers.length - 1; i >= 0; i--) {
currentMarkers[i].remove();
}
}