Great thanks andy8mcdonalds, your solution worked perfect for me !
This issue I'm having now is trying to call a geolocation function using geocoder. I have something like this below
methods: {
locateAddress: function() { var geocoder = new google.maps.Geocoder(); var vm = this; geocoder.geocode({address: this.address}), function (results,status) { if(status === google.maps.Geocoderstaus.OK){ vm.map.setCenter(results[0].geometry.location); } }; }
}
But I get this error below
"Uncaught TypeError: Cannot read property 'apply' of undefined"
I think I need to figure out a way to use the callback Google says to use but I don't know how to with a module build of Vue like Webpack. Does anyone have any suggestions?
Can u help me?
'google' is not defined no-undef
export default { methods: { initMap: function () { this.map = new google.maps.Map(document.getElementById('map'), { center: {lat: 83.9207, lng: 35.9565}, scrollwheel: false, zoom: 4 }) } }, mounted: function () { this.initMap() } }
Please or to participate in this conversation.