function onEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature,//鼠标移入事件 mouseout: resetHighlight,//鼠标移出事件 click: zoomToFeature//鼠标点击事件 }); }
let geoJsonLayer = L.geoJson(coordinates, { style: style, pane: pane, onEachFeature: (feature, layer) => {//onEachFeature回调 关键方法
if (onEachFeature) {
onEachFeature(feature, layer); }
}
}).addTo(this.editLayer);