简体   繁体   English

错误“包含”在Google Maps JS API中未定义

[英]Error `contains` undefined in Google Maps JS API

function gB(a,b,c){b[rb](function(b){var e="Om"==c?b[gl]():b.get("latLngPosition");e&&!b.pegmanMarker&&a[Vb](e)?rp(c,"-v",b):sp(c,"-v",b)})};

It tells me there's an error here. 它告诉我这里有一个错误。

  • Firefox calls it "a is undefined". Firefox称其为“ a undefined”。
  • Chrome calls it "Uncaught TypeError: Cannot call method 'contains' of undefined" Chrome称其为“未捕获的TypeError:无法调用未定义的方法'包含'”
  • Safari calls it "TypeError: 'undefined' is not an object (evaluating 'a[gb]')" Safari将其称为“ TypeError:'undefined'不是对象(正在评估'a [gb]')”

This is related to markers. 这与标记有关。 After walking through breakpoints: 经过断点后:

  • The "b" variable is some marker data with title , map , position , etc attributes. “ b”变量是一些带有titlemapposition等属性的标记数据。
  • The "gl" variable is "getPosition". “ gl”变量是“ getPosition”。
  • The "e" variable ends up evaluating out to a position object (lat/lng). “ e”变量最终求出一个位置对象(lat / lng)。
  • The "a" variable is being passed in as undefined, which explains the error. “ a”变量以未定义的形式传递,这说明了错误。
  • The "Vb" variable is "contains", which explains the Chrome error. “ Vb”变量为“包含”,这说明了Chrome错误。

Since this is a Google script, I'm wondering if I have something funky going on in my codebase or how to resolve this. 由于这是一个Google脚本,所以我想知道我的代码库中是否有一些时髦的事情或如何解决这个问题。 Anyone else run into this? 还有其他人遇到吗? What is "a" supposed to be? “ a”应该是什么?


This is being called from this in main.js . 这是在main.jsmain.js

ig[E].forEach = function(a) {
    var b = this.va, c;
    for (c in b)
        a[Gc](this, b[c])
};

In this code, "a" references the snippet block shown above. 在此代码中,“ a”引用上面显示的代码段。 So a[Gc](this, b[c]) essentially evaluates to gB.call(this, markerObject); 因此a[Gc](this, b[c])本质上gB.call(this, markerObject);

This was because I had been using "3.exp" which is the experimental API. 这是因为我一直在使用实验性API“ 3.exp”。 I guess there was an error happening in it and I didn't realize. 我想其中发生了错误,但我没有意识到。 Switched to production, 3.13, and it fixed the bug. 切换到生产版本3.13,并修复了该错误。 Cheers to geocodezip for asking about the API version. geocodezip欢呼,询问有关API版本的信息。

Defect report 缺陷报告

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM