我的问题类似于this question
问题是我关闭Infowindow上的按钮不会被显示,但按钮有效。 我尝试了很多东西,也许你可以提供一点提示或解决方案:)
非常感谢您提前!
Home.ts
setProductMarker(product :any, productLocation :any){
var productMarker = new google.maps.Marker({
position: new google.maps.LatLng(JSON.parse(productLocation).latitude, JSON.parse(productLocation).longitude),
map: this.map,
title: "Product"
})
var infoWindow = new google.maps.InfoWindow({
content: "test"
});
google.maps.event.addListener(infoWindow, 'domready', () => {
//now my elements are ready for dom manipulation
var clickableItem = document.getElementById('clickableItem');
clickableItem.addEventListener('click', () => {
this.goToProductPage(product);
});
});
productMarker.addListener('click', event => {
if( this.prev_infowindow ) {
this.prev_infowindow.close();
}
this.prev_infowindow = infoWindow;
infoWindow.open(this.map, productMarker);
});
}
home.html的
<div id="map"></div>
home.css
img[src*="gstatic.com/"], img[src*="googleapis.com/"] {
max-width: none;
}