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

How to get the latitude and longitude . #91

Closed aungnyithit-21 closed 2 years ago

aungnyithit-21 commented 2 years ago

Hello Sir , I want to get the latitude and longitude when I click on the map in state of vue . How can I do that?

HusamElbashir commented 2 years ago

Hi @aungmyaethit

You can listen to a click event on the map. Example: https://stackblitz.com/edit/vitejs-vite-4tdpur?file=src%2Fcomponents%2FHelloWorld.vue&terminal=dev

You get a MapMouseEvent in your event handler that contains latLng which has lat and lng getter functions: https://developers.google.com/maps/documentation/javascript/reference/map#MapMouseEvent

aungnyithit-21 commented 2 years ago

Hi @HusamIbrahim

Thank you so much for answer, It really support me.