我想让 android 后退按钮后退一步并删除掉落的标记,有什么可能的方法可以做到这一点吗?
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()
marker.setMap(null)
传入null
以将标记设置为null
有关详细信息,请参阅 https://developers.google.com/maps/documentation/javascript/examples/marker-remove