Uncaught TypeError:无法读取null的属性'__e3_' [英] Uncaught TypeError: Cannot read property '__e3_' of null

查看:868
本文介绍了Uncaught TypeError:无法读取null的属性'__e3_'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出现错误 Uncaught TypeError:在Google地图中拖动多边形时,无法随机读取属性'__e3_'为空>。我的意思是,大多数时候拖动多边形的方式都按预期工作,但很少有几次失败。

在Google Chrome控制台中,显示的错误为:
$ b <1>错误标题:

 未捕获的TypeError:无法读取null js的属性'__e3_'libraries = drawing,geometry:87 



2)错误正文:

  _。 I.hasListeners @ js?libraries = drawing,geometry:87 
_.I.trigger @ js?libraries = drawing,geometry:88
W1 @ poly.js:20
_.t .mm @ poly.js:82
_.I.trigger @ js?libraries = drawing,geometry:88
(匿名函数)@ js?libraries = drawing,geometry:34
_ .I.trigger @ js?libraries = drawing,geometry:88
(anonymous function)@ common.js:79
_.I.trigger @ js?libraries = drawing,geometry:88
Mm @ common.js:69
(匿名函数)@ common.js:225
(匿名函数)@ common.js:225

编辑:
代替粘贴代码块,我提供了一个小提琴作为代码工作的例子:
https://jsfiddle.net/w6Lnk47u/16/



错误似乎在这一行:

  var isMarkerContained = google.maps.geometry .poly.containsLocation(CREAR_CAMP.markerWithLabelCasaClub.getPosition(),CREAR_CAMP.polygonArea); 

要重现错误,必须有人:

1)先点击左启用的,然后在地图上绘制一个多边形。 2)点击右边现在启用的按钮(当多边形的绘制完成后启用),它会在多边形内出现一个标记。现在是错误可能发生的时刻。有人只需尝试移动并调整多边形的大小(尝试将标记从多边形区域中移出),它就会在Google Chrome控制台中显示错误。正如我所说的那样,它会随机发生并且发生几次。

解决方案

这似乎是Google的一个漏洞。 b
$ b

以下代码是最小代码, Google建议进行绘图: https://jsfiddle.net/TomKarachristos/hc7nwwdx/。我只更改选项。



如果您玩的足够多,您将看到相同的错误被触发,所以在您的代码中不存在问题。



如果你不想出现这个错误,你必须使用window.onerror:

 窗口。 onerror =函数(msg,url,lineNo,columnNo,error){
#maybe一些条件码
return true; / /禁止错误
}

但我不推荐它。


I'm getting the error Uncaught TypeError: Cannot read property '__e3_' of null randomly when dragging a polygon inside a google map. I mean, most of the times when I drag the polygon works as expected, but rarely a few times fails.

In the Google Chrome console, the error shown is:

1) Error header:

Uncaught TypeError: Cannot read property '__e3_' of null js?libraries=drawing,geometry:87

2) Error body:

_.I.hasListeners    @   js?libraries=drawing,geometry:87
_.I.trigger @   js?libraries=drawing,geometry:88
W1  @   poly.js:20
_.t.mm  @   poly.js:82
_.I.trigger @   js?libraries=drawing,geometry:88
(anonymous function)    @   js?libraries=drawing,geometry:34
_.I.trigger @   js?libraries=drawing,geometry:88
(anonymous function)    @   common.js:79
_.I.trigger @   js?libraries=drawing,geometry:88
Mm  @   common.js:69
(anonymous function)    @   common.js:225
(anonymous function)    @   common.js:225

Edited: Instead of pasting the chunks of code, I provide a fiddle as an example with the code working: https://jsfiddle.net/w6Lnk47u/16/

The error seems to be in this line:

var isMarkerContained = google.maps.geometry.poly.containsLocation(CREAR_CAMP.markerWithLabelCasaClub.getPosition(), CREAR_CAMP.polygonArea);

To reproduce the error, someone has to:

1) Click on the left-enabled one first and draw a polygon on the map.

2) Click to the right now enabled button (when the draw of the polygon finishes it enables) and it will appear a marker inside the polygon. Now is when the error could come. Someone just have to try moving and resizing the polygon (trying to leave the marker out of the polygon area) and it will appear the error in the Google Chrome console. As I said, it happens randomly and few times.

解决方案

It's seem to be a bug with Google.

Here is a fiddle with the minimum code that Google suggests for drawing: https://jsfiddle.net/TomKarachristos/hc7nwwdx/. I only change the options.

if you play enough you will see that the same error is triggered, so is not a problem in your code.

if you want not appear this error you must use the window.onerror:

window.onerror = function(msg, url, lineNo, columnNo, error) {
  #maybe some condition code
  return true; //suppress error
}

but I don't recommend it.

这篇关于Uncaught TypeError:无法读取null的属性'__e3_'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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