0👍
the passed in variable place
in setPlace(place)
has properties .geometry.location.lag()
and .geometry.location.lng()
. These are your latitude and longitude values for the entered address. Use these to set the latitude
and longitude
variables used by your <input>
elements
setPlace(place) {
this.markers.splice(0, this.markers.length);
this.places.splice(0, this.places.length);
this.currentPlace = place;
this.updateLocation(place.formatted_address);
this.addMarker();
this.latitude = place.geometry.location.lat();
this.longitude = place.geometry.location.lng();
},
I do also want to point out that you’ve created latitude
and longitude
as props, which aren’t meant to be mutated. If you don’t have a reason to have them as props put them as data
variables instead
Source:stackexchange.com