Leaflet has an option called scrollWheelZoom, but Vue2Leaflet doesn't support it.
As a workaround for now, I have this code in my root component:
mounted() {
// Hack to turn off scrollWheelZoom, since vue2-leaflet doesn't support it
this.$nextTick(() => {
let map = this.$refs.map.mapObject;
let layers = [];
map.eachLayer(l => {
layers.push(l);
});
let options = { ...map.options, layers: layers, scrollWheelZoom: false };
map.remove();
this.$refs.map.mapObject = L.map(this.$refs.map.$el, options);
});
},
(This require <l-map ref="map"> to be set.)
I would prefer to just set <l-map :scroll-wheel-zoom="false">.
You can simply do:
<l-map :options="{scrollWheelZoom:false}"
Options prop gets bound to leaflet options
@carlmjohnson if my answer satisfy your needs please close the issue :)
Awesome, thanks! Can this be added to the docs somewhere? I searched the repo for scrollWheelZoom and didn't find it.
I am thinking to make a big doc pr I will make an issue about it today, any help would be welcomed!
Most helpful comment
You can simply do:
<l-map :options="{scrollWheelZoom:false}"Options prop gets bound to leaflet options