5

I am adding Leaflet.markercluster plugin to my existing Leaflet map.

I am getting this error:

Uncaught TypeError: this._featureGroup.addEventParent is not a function

In relation to the line var locations = L.markerClusterGroup();.

I cannot find any information about what this error might mean.

I am linking to the Markercluster JS file, and after Leaflet. Not sure why else it would not be able to find a function.

4

2 回答 2

12

这是当您使用 Leaflet version < 1 (eg 0.7.7) 和 Leaflet.markercluster version 1+ (eg 1.0.0)时遇到的错误

演示:https ://jsfiddle.net/z6bc79dq/

如插件主页所述:

需要传单 1.0.0

对于 Leaflet 0.7 兼容版本,请使用 Leaflet-0.7 分支

(Leaflet.markercluster 版本0.5.0是与 Leaflet 兼容的最新版本0.7.x

于 2016-10-14T03:33:52.443 回答
1

当我尝试将无效层(通过集群组addLayers方法)添加到集群组时,我也遇到了这个错误。(我试图将标记添加到集群组,但标记实际上不是标记)。

希望这可以帮助某人

于 2019-01-27T04:16:32.430 回答