如何删除掉落的地图标记?

How to remove Dropped map marker?

我想让 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