Closed jpschutte closed 1 year ago
I have the following code in my project and it is working fine:
<gmap-autocomplete
:component-restrictions="{ country: currentOrg.address.countryCode }"
:fields="['name', 'address_components', 'formatted_address', 'geometry']"
@place_changed="setPlace"
>
<template
#input="{ listeners, attrs }"
>
<v-text-field
ref="input"
:prepend-icon="icons.maps"
placeholder="Enter site name or address"
v-bind="attrs"
v-on="listeners"
/>
</template>
</gmap-autocomplete>
@jpschutte looking at your code you have your ref name mismatched, you must either use the name "input" or you must explicitly provide the ref name using the child-ref-name prop on the autocomplete
@davydnorris you seem to use #input instead of the #default slot, in v2 the slot was renamed https://github.com/diegoazh/gmap-vue/blob/2384ea756a532c13e5a2fec5d7f7a491b30e22f6/packages/gmap-vue/src/components/autocomplete-input.vue#L9 I am missing something?
@tux2nicolae it's not the slot it's the ref name on the customised input component that's important. You either have to change your ref from "autocomplete" to "input", or you have to use the prop slotRefName="autocomplete" to explicitly declare what ref you are using
Describe the bug
If using a slot, the @place_changed no longer works. However, just using props without using the default slot works and fires the place_changed event.
A clear and concise description of what the bug is.
Works
Does not work
I think the documentation could be wrong? Where I think it should be
v-on="slotProps.$listeners"
andv-bind="slotProps.$attrs"
. But this way also doesn't work. I've also tried just using a<input/>
instead of<v-text-field/>
but this also made no difference.To reproduce
Steps to reproduce the behavior:
Expected behavior
The method that is attached to the place_changed event should fire when using a default slot.
Current behavior
The method that is attached to the place_changed event does not fire when using a default slot.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information)
Smartphone (please complete the following information)
Additional context
Add any other context about the problem here.
Versions
Package manager
Plugin version