在离子科尔多瓦插件谷歌地图上打开几个自定义信息窗口



我是IoniFramework的新手。 我正在构建一个应用程序,与科尔多瓦谷歌地图插件一起工作。 我的问题是:我希望所有自定义信息窗口都将在加载地图后显示。我已经尝试了很多选择,但仍然没有运气。 现在,每次单击标记时,它只会打开一个窗口,并在单击另一个标记时关闭它。也许有人可以帮助我解决这个问题?多谢!!

addMarkers(markers){
  for(let marker of markers){
    this.map.addCircle({
      center:{lat:marker.lat, lng:marker.lng},
      radius: 50,
      strokeColor: 'red',
      strokeWidth:1,
      fillColor:'red'
    });
    this.map.addMarker({
      icon: {
        'url': "./assets/marker.png",
        'size': {
          width: 27,
          height: 10
        },
      },
      animation: 'DROP',
      position: {
        lat: marker.lat,
        lng: marker.lng
      }
    }).then((marker)=>{
      marker.on(GoogleMapsEvent.MARKER_CLICK)
      .subscribe(() => {
      this.bindInfo(marker,  this.setDiv(div));
    })
    })
}
}
setDiv(div){
  let compFactory = this.resolver.resolveComponentFactory(DivComponent);
  this.compRef = compFactory.create(this.injector);
  if (this.compRef) this.compRef.instance.timeInSeconds = div.time;
  this.appRef.attachView(this.compRef.hostView);
  let div = document.createElement('div');
  div.appendChild(this.compRef.location.nativeElement);
  return div
  }
bindInfo(marker,  content){
    let info= new HtmlInfoWindow();
    info.setContent(content);
    info.open(marker)
}
不幸的是,

您不能同时显示多个信息窗口。

源:https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/329

最新更新