问题描述
我正在尝试通过Google Map API中的标记显示infoWindow。
当我单击它时,信息窗口的气泡出现,但它是空的。但是,我很确定它包含所有数据,因为气泡的大小根据应显示的内容而变化。此外,通过单击,我可以很好地将数据打印到控制台中。
看起来字体的颜色是透明的...
addMarkersToMap(alert) {
let position = new google.maps.LatLng(alert.latitude,alert.longitude);
let mapMarker = new google.maps.Marker({
position: position,map: this.map,title: alert.alertTitle,latitude: alert.latitude,longitude: alert.longitude,icon : new google.maps.MarkerImage("../assets/icon/point.png")
});
mapMarker.setMap(this.map);
this.addInfoWindowToMarker(mapMarker);
}
addInfoWindowToMarker(marker) {
let infoWindowContent = '<div id="content">' +
'<h2 id="firstheading" class"firstheading">' + marker.title +'</h2>' +
'<p> Latitude: ' +marker.latitude +' </p>' +
'<p> Longitude: ' +marker.longitude +' </p>'
'</div>';
let infoWindow = new google.maps.InfoWindow({
content: infoWindowContent
});
marker.addListener('click',() => {
console.log(marker.title)
console.log(marker.latitude)
infoWindow.open(this.map,marker);
});
this.infoWindows.push(infoWindow);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)