vue-google-maps
vue-google-maps copied to clipboard
loading not complete at loaded event trigger
Hi,
Plain and simple:
import { loaded } from '~/node_modules/vue2-google-maps/src/main'
export default {
created() {
loaded.then(() => {
console.log(this.$refs.gmap.$mapObject) // undefined?!
}
},
}
I may be wrong but it seems wrong to me to not be able to access the object after loaded event triggered. : / I don't have any time to try to fix it, sorry.
Best regards.
If you want the mapObject, you need $mapPromise.then(() =>{... CODE HERE...})
This is because loaded only loads the Google Maps API, but the maps have not been initialized.
On 19 Jan 2018 23:59, "Remy RUIZ" [email protected] wrote:
Hi,
Plain and simple:
import { loaded } from '~/node_modules/vue2-google-maps/src/main' export default { created() { loaded.then(() => { console.log(this.$refs.gmap.$mapObject) // undefined?! } }, }
I may be wrong but it seems wrong to me to not be able to access the object after loaded event triggered. : / I don't have any time to try to fix it, sorry.
Best regards.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xkjyeah/vue-google-maps/issues/294, or mute the thread https://github.com/notifications/unsubscribe-auth/ACiTR64vwcJkmx-bELRIXszfoXw2DjLtks5tMLvMgaJpZM4Rkrg7 .
Okay got it. Maybe include this in the doc, I don't know how to get the info otherwise. I wish I had more time to help you with. Thanks! :)
Hey, I closed this a bit fast (had some other things to do).
Where is the $mapPromise
object? I thought it was in the map as well as $mapObject
but it's not.
So I guess it's somewhere else?
use $mapCreated
.
None of these options appear to work in a child component. I'm attempting to use the method map.getProjection()
inside the handler for the this.$mapPromise.then(map => { ... })
and, somehow, even if map is defined, it sometimes gives me map.getProjection() is not a function
which is a very strange error that I imagine is related to whatever wrapping process is done to the raw map instance.
@dkushner Same issue for me.
None of these options appear to work in a child component. I'm attempting to use the method
map.getProjection()
inside the handler for thethis.$mapPromise.then(map => { ... })
and, somehow, even if map is defined, it sometimes gives memap.getProjection() is not a function
which is a very strange error that I imagine is related to whatever wrapping process is done to the raw map instance.
Is there a solution for this in 2022?