我目前有一个Leaflet地图,它从GeoJSON文件中提取数据并将其聚类,如下所示:
var markers = L.markerClusterGroup({
showCoverageOnHover: true,
spiderfyOnMaxZoom: true
});
var geoJsonLayer = L.geoJson(thefts, {
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.bike_value);
}
});
markers.addLayer(geoJsonLayer);
map.addLayer(markers);
map.fitBounds(markers.getBounds());
中间部分给我带来了一些麻烦:
var geoJsonLayer = L.geoJson(thefts, {
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.bike_value);
}
});
每次我尝试点击弹出窗口时,都会收到一个控制台错误,指出未捕获错误:NotFoundError:DOM异常8 。错误堆栈如下所示:
Uncaught Error: NotFoundError: DOM Exception 8 leaflet.js:7
o.Popup.o.Class.extend.onRemove leaflet.js:7
o.Map.o.Class.extend.removeLayer leaflet.js:6
o.Map.include.closePopup leaflet.js:7
o.Popup.o.Class.extend._close leaflet.js:7
o.Marker.include.closePopup leaflet.js:7
o.Marker.include.togglePopup leaflet.js:7
o.Mixin.Events.fireEvent leaflet.js:6
o.Marker.o.Class.extend._onMouseClick leaflet.js:7
t.(anonymous function).s
有关可能导致此问题的任何想法?我知道还有其他与DOM异常8相关的问题,但我找不到任何与我正在做的事情有关的事情。