INFO_cLICK事件在使用离子3簇标记时未触发



我面临集群映射的info_click问题我的代码:

let markerCluster: MarkerCluster = this.map.addMarkerClusterSync({
markers: data,
boundsDraw: false,
icons:[]
});
let marker: Marker;
markerCluster.on(GoogleMapsEvent.MARKER_CLICK).subscribe((params) => {
marker = params[1];
marker.setTitle(marker.get("name"));
marker.setSnippet(marker.get("address"));
marker.showInfoWindow();
marker.one(GoogleMapsEvent.INFO_CLICK).then(()=>{
console.log('info click');
})
});

我的包.json:

"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "^4.18.0",
"@ionic-native/date-picker": "^4.18.0",
"@ionic-native/google-maps": "^4.15.1",
"@ionic-native/splash-screen": "~4.17.0",
"@ionic-native/status-bar": "~4.17.0",
"@ionic/storage": "2.2.0",
"cordova-browser": "5.0.4",
"cordova-plugin-datepicker": "0.9.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-googlemaps": "2.4.6",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.3.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-angular": "3.9.2",
"ionic2-rating": "^1.2.2",
"ionicons": "3.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.1",
"typescript": "~2.6.2"
}

当前行为:正在获取以下错误

polyfills.js:3未捕获错误:侦听器for one((/addEventListenerOnce((方法不是函数在Marker.one(BaseClass.js:108(在地图视图。ts:339在t.invokeTask(polyfills.js:3(在r.runTask(polyfills.js:3(在e.invokeTask(polyfills.js:3(在i.isUsingGlobalCallback.invoke(polyfills.js:3(在n(polyfills.js:3(

OS:浏览器

我已经解决了问题。markerCluster.on(GoogleMapsEvent.MARKER_CLICK(.subscribe((params(=>{

let latLng: LatLng = params[0];
let marker: any = params[1];
marker.setTitle(marker.get("name"));
marker.setSnippet(marker.get("address"));
marker.showInfoWindow(); 
console.log(params);
console.log(latLng);
console.log(marker);
marker.setAnimation(GoogleMapsAnimation.BOUNCE);
marker.one(GoogleMapsEvent.INFO_CLICK, function() {
console.log('info click',marker);
});

});

最新更新