В следующем примере показано, как обрабатывать событие щелчка карты в Vue2Leaflet
:
<l-map :zoom="zoom" :center="center" @click="handleMapClick">
<l-tile-layer :url="url" :attribution="attribution"></l-tile-layer>
</l-map>
export default {
name: "LeafletMap",
components: {
"l-map": LMap,
"l-tile-layer": LTileLayer,
"l-marker": LMarker
},
data() {
return {
zoom: 13,
center: L.latLng(47.41322, -1.219482),
url: "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
attribution:
'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
};
},
methods: {
handleMapClick(event) {
//...
}
}
};
Вот демонстрационная версия