Skip to content

Instantly share code, notes, and snippets.

@achingachris
Created April 19, 2022 06:08
Show Gist options
  • Save achingachris/be74873de340c2a0e8b903f82c94cac3 to your computer and use it in GitHub Desktop.
Save achingachris/be74873de340c2a0e8b903f82c94cac3 to your computer and use it in GitHub Desktop.
methods: {
initMarker(loc) {
this.existingPlace = loc;
},
addLocationMarker() {
if (this.existingPlace) {
const marker = {
lat: this.existingPlace.geometry.location.lat(),
lng: this.existingPlace.geometry.location.lng(),
};
this.locationMarkers.push({ position: marker });
this.locPlaces.push(this.existingPlace);
this.center = marker;
this.existingPlace = null;
}
},
locateGeoLocation: function () {
navigator.geolocation.getCurrentPosition((res) => {
this.center = {
lat: res.coords.latitude,
lng: res.coords.longitude,
};
});
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment