Skip to content

Instantly share code, notes, and snippets.

@softauthor
Created March 22, 2020 02:07
Show Gist options
  • Save softauthor/99b140fd7507c5f7e5b08ad7910f2cb6 to your computer and use it in GitHub Desktop.
Save softauthor/99b140fd7507c5f7e5b08ad7910f2cb6 to your computer and use it in GitHub Desktop.
addLocationsToGoogleMaps() {
var map = new google.maps.Map(this.$refs['map'], {
zoom: 15,
center: new google.maps.LatLng(this.lat, this.lng),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
this.places.forEach((place) => {
const lat = place.geometry.location.lat;
const lng = place.geometry.location.lng;
let marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lng),
map: map
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment