Access a map defined in another component

Viewed 81

I'm developing a map using leaflet and now I'm trying to access to the map into map.vue in the component polyline.vue.

In the component of the map I created the map like this :

<l-map v-if="showMap" ref="map" :zoom="zoom" :center="center" :options="mapOptions" style="height: 80%" @update:center="centerUpdate" @update:zoom="zoomUpdate">

But I want to use the fonction distance of the library GeometryUtil (http://makinacorpus.github.io/Leaflet.GeometryUtil/global.html#distance) and for that I need the map.

Can I use this.$refs.map.mapObject in another component, or there is another way like with a v-bind or something like that?

Thank you for helping me !

0 Answers
Related