I would like to add and remove Markers in my Leaflet Map. i found this good topic but the code is in JS.
Leaflet - How to find existing markers, and delete markers?
My code is like that :
<template>
<l-map :zoom="zoom" :center="center">
<l-tile-layer :url="url" :attribution="attribution"></l-tile-layer>
<l-marker :lat-lng="marker" :draggable=true></l-marker>
</l-map>
</template>
<script>
data:function() {
return {
zoom:7,
center: L.latLng(33.901445, -5.532788),
url:'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a>
contributors',
marker: L.latLng(47.413220, -1.219482),
}},
</script>
Maybe i should start by creating a function on click like that :
<l-map :zoom="zoom" :center="center" v-on:click="addMarker"></l-map>
And then i wrtie the correct addMarker Function in method. But i can't find the right doc for that.
I would like also to get the position of the new Marker in Data..
Thank you