inocan-group / vue3-google-map

A set of composable components for easy use of Google Maps in your Vue 3 projects.
https://vue3-google-map.com
MIT License
272 stars 54 forks source link

Question: How to move marker? #116

Closed lukepower closed 1 year ago

lukepower commented 1 year ago

Hi, is there any way to move an existing marker to other coordinates? When changing the underlying data the marker is not updated, and there seems to be no way to call the API's setPosition function...

Thanks

HusamElbashir commented 1 year ago

Yes there is you'll just have to replace the entire position object. Unfortunately we don't deep watch options so you can't just change lat/lng.

nonickDev commented 1 year ago

Hi, is there any way to move an existing marker to other coordinates? When changing the underlying data the marker is not updated, and there seems to be no way to call the API's setPosition function...

Thanks

<Marker :options="{ position: {lat: lat, lng: lng}, draggable: true }" @dragend="markerDragend"/>

methods: { markerDragend(event) { console.log('dragend', event.latLng.lat(), event.latLng.lng()) }, }