我正在尝试传递一个参数以通过单击多边形来绑定它,我有以下内容:
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)