【发布时间】:2018-07-15 23:44:12
【问题描述】:
window.initMap=function() {
var options = {
zoom: 3,
center: {lat: -28.024, lng: 140.887}
}
var ourmap = new google.maps.Map(document.getElementById('map'),options);
// Add some markers to the map.
// Note: The code uses the JavaScript Array.prototype.map() method to
// create an array of markers based on a given "locations" array.
// The map() method here has nothing to do with the Google Maps API.
var markers = new google.maps.Marker({
setMap: ourmap,
position: locations
});
// Add a marker clusterer to manage the markers.
var markerCluster = new MarkerClusterer(map, markers,
{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
}
locations 在下面声明为一个坐标数组。我在文件 js?key=MYAPIKEY&libraries=places&callback=initMap
中不断收到大量错误,上面写着“this.map_.getZoom 不是函数”【问题讨论】:
-
在google中搜索错误...前两个结果...stackoverflow.com/questions/13434750/…和productforums.google.com/forum/#!topic/maps/Q27GYsOtccM
-
请提供一个minimal reproducible example 来证明您的问题。