state = {
markers: [],
maxMarkersNum: 666,
}
onClick = ({ latlng }) => {
this.setState(({ markers, maxMarkersNum }) => ({
markers: markers.length >= maxMarkersNum
? []
: [ ...markers, latlng ],
}));
}
<Map onClick={this.onClick}>
{this.state.markers.map(n => <Marker position={n} />)}
</Map>
onMarkerMouseOver() {
this.openPopup();
}
<Marker onMouseOver={this.onMarkerMouseOver}>
:options="{ scrollWheelZoom: false }"
@update:zoom="zoom = $event"
@wheel.native="onWheel"
methods: {
onWheel(e) {
if (e.deltaY < 0) {
this.zoom++;
e.preventDefault();
}
},
},
<div ref="map">
mounted() {
this.map = L.map(this.$refs.map).setView([ 55.75222, 37.61556 ], 13);
...
marker.on('popupopen', function(e) {
new Vue({ el: e.popup._contentNode });
});