vue-google-autocomplete
vue-google-autocomplete copied to clipboard
For posterity: conflict between bound `type` property in Vue component and Google Maps API JS
Hi there -- thanks for an excellent component! I incorporated the core VueGoogleAutocomplete.vue
component into a generic form input field component and discovered a strange conflict (strange to me, anyway -- I'm new to Vue and the Google Maps API):
When setting a type
attribute on the <input>
element in the component template using a bound prop (:type='inputType'
), the Google Maps scripts wouldn't attach properly to the element. By applying the attribute using $refs
(e.g. this.$refs.[refname].setAttribute('type', inputType)
), I was able to avoid the conflict.
Not sure what was going on here, but just wanted to mention the issue and my workaround in case that's helpful to others.