Google maps 如何删除已删除的地图标记?
我想让安卓后退按钮后退一步,并删除掉的标记,有没有任何可能的方法做到这一点Google maps 如何删除已删除的地图标记?,google-maps,google-maps-api-3,ionic2,google-maps-markers,Google Maps,Google Maps Api 3,Ionic2,Google Maps Markers,我想让安卓后退按钮后退一步,并删除掉的标记,有没有任何可能的方法做到这一点 public AddMarker(){ let image = '/assets/img/rsz_marker.png'; let marker = new google.maps.Marker({ map: this.map, animation: google.maps.Animation.DROP, position: this.map.getCenter()
public AddMarker(){
let image = '/assets/img/rsz_marker.png';
let marker = new google.maps.Marker({
map: this.map,
animation: google.maps.Animation.DROP,
position: this.map.getCenter()
, icon: image
});
}
platform.registerBackButtonAction(() => {
if (this.nav.canGoBack()) {
this.nav.pop();
} else {
//*remove marker?
}
});
要从映射中删除标记,可以使用api调用
setMap()
传入null
以将标记设置为null
有关详细信息,请参阅
marker.setMap(null)