address selection: move marker on the leaflet map on update map

This commit is contained in:
nobohan 2021-05-12 11:52:05 +02:00
parent 743b456030
commit 0afcf3d79e

View File

@ -11,6 +11,7 @@ import markerIconPng from 'leaflet/dist/images/marker-icon.png'
import 'leaflet/dist/leaflet.css';
let map;
let marker;
export default {
name: 'AddressMap',
@ -32,11 +33,12 @@ export default {
iconUrl: markerIconPng,
});
L.marker([48.8589, 2.3469], {icon: markerIcon}).addTo(map);
marker = L.marker([48.8589, 2.3469], {icon: markerIcon}).addTo(map);
},
update() {
console.log('update map with : ', this.address.addressMap.center)
marker.setLatLng(this.address.addressMap.center);
map.setView(this.address.addressMap.center, 12);
}
},