Skip to content

Instantly share code, notes, and snippets.

@2Fwebd
Created February 5, 2019 21:34
Show Gist options
  • Save 2Fwebd/b8e9ea6070e936d3cd8a9a02dc10dec9 to your computer and use it in GitHub Desktop.
Save 2Fwebd/b8e9ea6070e936d3cd8a9a02dc10dec9 to your computer and use it in GitHub Desktop.
(function() {
Vue.component('woffice-members-map', {
template: '<div id="woffice-members-map__content"></div>',
props: ['url', 'height'],
data: function () {
return {
loaded: false,
mapObject: null,
center: {
lat: 50.629250,
lng: 3.057256,
},
zoom: 10,
members: []
}
},
mounted: function() {
this.createMap();
},
methods: {
/**
* Create the map and set the container's height according to the attribute
*/
createMap: function() {
var $map = $('#woffice-members-map__content');
$map.height(this.height);
this.mapObject = new google.maps.Map($map[0], {
center: {
lat: parseFloat(this.center.lat),
lng: parseFloat(this.center.lng)
},
zoom: this.zoom,
});
}
}
});
new Vue({
el: $('#woffice-members-map__wrapper')[0],
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment