Google maps API : Autocomplete
-
Hi there !
Has anyone managed to make the GoogleMap Autocomplete API working with new <q-input> or <q-autocomplete> components ? Is there any demo anywhere about this
?
Used vue-gmaps before (https://www.npmjs.com/package/vue-gmaps) on input, but it’s not working anymore on <q-input>.Thank you
-
What part isn’t working for you?
Try to use AutocompleteService as it’s not bound to any UI component and you can trigger it yourself. -
Hmm I’ll check that one didn’t noticed it first !
Thank you
-
Ok managed to make it works on input :
mounted () {
let self = this
let address_input = this.$refs.address_input.$refs.input
let address_input_autocomplete = new google.maps.places.Autocomplete(address_input)
address_input_autocomplete.addListener(‘place_changed’, function () {
let place = address_input_autocomplete.getPlace()
console.log(place)
})
}On console.log I’ve the result when a user select a place, just have to bind it to a data value now :).
Thank you @a47ae for your suggestion !
-
hi! Any one has an complete example? please!