Closed reslear closed 2 years ago
You could use what you refer to as the ref solution in https://vue3-google-map.netlify.app/advanced-usage/ if you just need access to the api. We currently don't expose the api and map symbols, but it might be useful if we want to allow people to write their own custom components that add additional features. Something to think about.
Sorry i'm reading this and not sure what the feature request is here. Can someone please elucidate this?
@ksnyde global api provide google
api for use google maps api
without refs in composable solution and component without maps, for example future place autocomplete
ps. place autocomplete components planned?
@reslear can you give me a code example? Feel free to use a syntax you want rather than one that exists if that's needed but bear in mind our intention with the google API exposed by @googlemaps/js-api-loader
is to allow you to do whatever you like with it directly. It is not our concern and our ambition is to be "out of the way" for this.
I've got an single page app that displays a map on some routes, and on other routes it uses the google maps api without a map (places autocomplete, geocoding).
Ideally, I'd like to initialize the api loader once, and pass around the instance to components as needed.
Would it be possible to pass the loader (or promise) to the GoogleMap component as a prop instead of it creating it's own from the api key?
Would it be possible to pass the loader (or promise) to the GoogleMap component as a prop instead of it creating it's own from the api key?
That shouldn't be hard to implement. I'll take a stab at it in the coming days.
@jrspitz Added this in v0.13.0
. You can now pass a promise through the apiPromise
prop which should resolve to the global google
object. Example:
https://stackblitz.com/edit/vitejs-vite-mgwr2y?file=src/components/HelloWorld.vue
i found provide https://github.com/inocan-group/vue3-google-map/blob/9ef51c45b97ac3c2d9bd72f91aed90f170a1505a/src/components/GoogleMap.vue#L79
how to inject api on my components googlemaps api aka
window.google
GmapApi
alternate https://github.com/xkjyeah/vue-google-maps/blob/vue2/src/main.jsor only use ref solution https://vue3-google-map.netlify.app/advanced-usage/ ?