You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to update my marker position when I click on the map. I can get the lat / lng from the current click position but I don't know how to update the marker props to update his position :
const updateposition= (e) => {
console.log(e.latLng.lat(), e.latLng.lng());
// How to changer le markerOptions position here ?? I have try with ref but doesn't work...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I try to update my marker position when I click on the map. I can get the lat / lng from the current click position but I don't know how to update the marker props to update his position :
const mapRef = ref(null);
const markerRef = ref(null);
const center = ref({ lat: 40.689247, lng: -74.044502 })
const markerOptions = ref({ position: { lat: 40.689247, lng: -74.044502 }, title: 'LADY LIBERTY', gmpDraggable: true })
const pinOptions = ref({ background: '#FBBC04' })
const updateposition= (e) => {
console.log(e.latLng.lat(), e.latLng.lng());
// How to changer le markerOptions position here ?? I have try with ref but doesn't work...
<GoogleMap @click="updateposition"
ref="mapRef"
api-key="xxxxxxxxx"
mapId="aeef71f947a9787c"
mapTypeId="satellite"
style="width: 100%; height: 500px"
:center="center"
:zoom="15"
>
Thanks
Beta Was this translation helpful? Give feedback.
All reactions