這是一個通用的JS問題。 在React-leaflet中,我想通過回調來處理事件。被調用的函數獲取調用者(事件)上下文,該上下文可用於執行像this.getZoom()這樣的東西。 onMoveend={this.moveend}
moveend(e){
// e is the event target
var zoomText = this.getZoom();
我正在關注leafletjs的interactive choropleth map示例,我試圖通過使用GeoJson對象的resetStyle方法和Map對象的fitBounds方法來添加交互。 var map = L.map('map');
function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}
v