小编ski*_*e3e的帖子

将参数传递给 oneachfeature 传单

我正在尝试传递一个参数以通过单击多边形来绑定它,我有以下内容:

var mapLayer = new L.TopoJSON(jsonMap, {style: style, onEachFeature: onEachFeature.bind(null,null,selectionManager), pane:'borders'}).addTo(this.map); 


 function onEachFeature(feature, layer, selectionManager) {
                    console.log(selectionManager)
                    layer.on({
                        mouseover: highlightFeature,
                        mouseout: resetHighlight,
                        click: dataFilter.bind(null,ID)
                    });
                }

 function dataFilter(selectionManager,e){
                    var layer = e.target;
                    var zoneName = layer.feature.properties.Index;
                    console.log(zoneName)
                    console.log(selectionManager);
                }
Run Code Online (Sandbox Code Playgroud)

所以我的目标是读取 dataFilter 中的一个参数(在这种情况下是 selectionManager)

javascript leaflet typescript

3
推荐指数
1
解决办法
1014
查看次数

标签 统计

javascript ×1

leaflet ×1

typescript ×1