我在React Component中使用此代码 此逻辑的目标是在单击show infowindow
之后clickInfoWindow = (event, element) => {
const { map } = this.state;
let placeID = event.currentTarget.id;
let { allMarkers, InfoWindow } = this.state;
let infowindow = InfoWindow.find(infowindow=>infowindow.marker.id == placeID)
let marker = infowindow.marker;
console.log(marker, infowindow);
infowindow.open(marker, map)
this.closeInfowindow();
}
我已经在另一个组件中创建了带有Google Maps构造函数的对象信息窗口。(单击here component in gist!