我正在构建一个离子3应用程序并尝试让htmlInfoWIndow显示在地图上,但没有任何运气。 我使用以下版本: " @ ionic-native / google-maps":" 4.4.2"," cordova-plugin-googlemaps":" ^ 2.1.1&#34 ;,
loadMap() {
let mapOptions: GoogleMapOptions = {
camera: {
target: {
lat: 43.0741904,
lng: -89.3809802
},
zoom: 18,
tilt: 30
}
};
this.map = GoogleMaps.create('map', mapOptions);
// Wait the MAP_READY before using any methods.
this.map.one(GoogleMapsEvent.MAP_READY)
.then(() => {
console.log('Map is ready!');
let htmlInfoWindow = new HtmlInfoWindow();
let html = [
'<h2>Title here....</h2>'
].join("");
htmlInfoWindow.setContent(html);
// Now you can use all methods safely.
this.map.addMarker({
position: {
lat: 43.0741904,
lng: -89.3809802
}
})
.then((marker: Marker) => {
marker.on(GoogleMapsEvent.MARKER_CLICK)
.subscribe(() => {
htmlInfoWindow.open(marker);
console.log('sad');
});
});
});
}
loadMap()函数在ionicviewenter上初始化。打印出控制台日志,但标记点击时没有出现信息窗口。
任何想法,我做错了什么? 谢谢, 特丽克丝