无法读取http://maps.googleapis.com/maps/api/中未定义的媒体资源'条目' [英] Cannot read property 'entries' of undefined in http://maps.googleapis.com/maps/api/

查看:432
本文介绍了无法读取http://maps.googleapis.com/maps/api/中未定义的媒体资源'条目'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一切正常,并突然出现错误无法读取它可能是未定义的属性'条目'? (包括googlemaps api)

未捕获TypeError:无法在js中读取未定义
的属性'entries'key =< API_KEY> & callback = Map.init:105



Map.init

  Map.init =函数(id){
id = id || '地图';
map = new google.maps.Map(document.getElementById(id),{
center:{lat:46.409998,lng:30.710000},
scrollwheel:true,
zoom :this.address?20:12
});

infoWindow = new google.maps.InfoWindow(); $(放大)zoomShowPoints&&!pointsVisibility) {
pointsVisibility = true;
points.forEach(function(item){
item.setVisible(pointsVisibility);
});
} else if(zoom< ; = zoomShowPoints&& pointsVisibility){
pointsVisibility = false;
points.forEach(function(item){
item.setVisible(pointsVisibility);
});
}
});

getUsers();
};


解决方案

Google于2017年11月更改了他们的Maps API脚本。使用全局变量Map打破了我们的网站。

  var Map;我们在脚本中将Map变量重命名为OurMap解决了问题。 

更改为;

  var OurMap; 


Everything worked and suddenly there was a mistake Cannot read property 'entries' of undefined that it could be ? (including googlemaps api)

Uncaught TypeError: Cannot read property 'entries' of undefined at js?key=<API_KEY>&callback=Map.init:105

Map.init

    Map.init = function (id) {
    id = id || 'map';
    map = new google.maps.Map(document.getElementById(id), {
        center: {lat: 46.409998, lng: 30.710000},
        scrollwheel: true,
        zoom: this.address ? 20 : 12
    });

    infoWindow = new google.maps.InfoWindow();

    map.addListener('zoom_changed', function () {
        var zoom = map.getZoom();
        if (zoom > zoomShowPoints && !pointsVisibility) {
            pointsVisibility = true;
            points.forEach(function (item) {
                item.setVisible(pointsVisibility);
            });
        } else if (zoom <= zoomShowPoints && pointsVisibility) {
            pointsVisibility = false;
            points.forEach(function (item) {
                item.setVisible(pointsVisibility);
            });
        }
    });

    getUsers();
};

解决方案

Google changed their Maps API script November 2017. They started using global variable Map which broke our site. Renaming the Map variable to OurMap in our script fixed the issue.

var Map;

changes to;

var OurMap;

这篇关于无法读取http://maps.googleapis.com/maps/api/中未定义的媒体资源'条目'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆