Skip to content

Instantly share code, notes, and snippets.

@FWSimon
Created March 23, 2016 09:09
Show Gist options
  • Save FWSimon/f9ed9f7568e932f642ff to your computer and use it in GitHub Desktop.
Save FWSimon/f9ed9f7568e932f642ff to your computer and use it in GitHub Desktop.
const VueGoogleMap = require('vue-google-maps');
module.exports = {
components: {
'google-map': VueGoogleMap.Map
},
data: function () {
return {
center : this.mapCoordinates,
markers: [{ 'position': {lat: 10.0, lng: 10.0} }],
clustering: true,
};
},
ready: function () {
VueGoogleMap.load({
key: 'AIzaSyCd6Cp_fm0tvwsvfMZTTFlXId3O77jnO8o',
v: '3.24' // Google Maps API version
});
var langPrefix = $('#langPrefix').val(); //Get the Landcode from the hidden element in main template
var mapCoordinates;
//We check if the URL is dk or pl and center the map to the right country.
switch (langPrefix) {
case 'dk':
mapCoordinates = { lat: 56.16744, log: 11.36104};
break;
case 'pl':
mapCoordinates = { lat: 51.1977299, log: 19.0184122};
break;
default:
mapCoordinates = { lat: 56.16744, log: 11.36104};
break;
}
this.CreateMap(mapCoordinates);
},
methods: {
/**
* Set center properties.
*/
CreateMap: function (mapCoordinates) {
console.log('set properties');
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment