Ridermansb / vue-gmaps

Search places and address using Google Maps API
https://ridermansb.github.io/vue-gmaps
GNU Affero General Public License v3.0
117 stars 13 forks source link

Question on multiple input fields #3

Open dbeaman opened 7 years ago

dbeaman commented 7 years ago

Thank you for posting this great plugin! I'm working on a simple google maps vuejs v2 page, that gives the distance between two addresses. Your plugin works great, however if I have two input fields, i get a duplicate call to google api error..

I was thinking I could make each input field a separate component containing your plugin, but then is callign the javascript API twice a good idea? If you have any insight, I'd appreciate it. thanks!

Ridermansb commented 7 years ago

Hey @dbeaman Great idea. I'm a little busy these weeks, but I'll work on it as soon as possible;

bemyguestdmitriy commented 7 years ago

Also had such issue. So created this package https://github.com/olefirenko/vue-google-autocomplete. @Ridermansb it is because of loadGoogleMapsAPI package. It includes Google Maps Places API two times.

adrianmejias commented 7 years ago

@dbeaman The best work around for right now is to load the Google API separately and then set loadGoogleApi to false in the vue-gmaps variables.

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&libraries=places"></script>

// main.js
import VueGmaps from 'vue-gmaps'
Vue.use(VueGmaps, {
  key: '<your api here>',
  loadGoogleApi: false
})