xkjyeah / vue-google-maps

Google maps component for vue with 2-way data binding
https://xkjyeah.github.io/vue-google-maps/
1.88k stars 475 forks source link

Google Maps loaded multiple times #705

Closed TehEbil closed 4 years ago

TehEbil commented 4 years ago

Hi, could someone update the file so it only calls apiLoad() if there is not loaded any google script already?

I am unfortunately also using another google module and it requires that I load it in html and they both load google. I need the other plugin almost everywhere and this one just at some pages, so it makes more sense for me if this plugin would check if there's already a google instance. This would be awesome :)

TehEbil commented 4 years ago

Actually, there's already an option to stop loading it found in here: https://github.com/xkjyeah/vue-google-maps/issues/257

Just change ur

Vue.use(VueGoogleMaps, {
load: () => ...
})

to

Vue.use(VueGoogleMaps)
window.vueGoogleMapsInit()

if you're sure that google maps is already loaded.

Don't forget to add your libraries to ur html script-loading: ...libraries=places,drawing,visualization&key=AI...