0

i am using v-autocomplete with autofocus.

<v-autocomplete
  autofocus
  solo
  rounded
  prepend-inner-icon="mdi-magnify"
  @keyup.enter="showFilteredItems"
  id="searchInput"
  :items="stocks"
  item-text="symbol"
  item-value="name"
  :filter="customFilter"
  ref="autocomplete">
  <template v-slot:item="data">
    <v-btn block depressed :to="`/stock/${data.item.symbol}/`">
      <v-list-item-title v-html="data.item.symbol"></v-list-item-title>
      <v-list-item-subtitle v-html="data.item.name"></v-list-item-subtitle>
    </v-btn>
  </template>
</v-autocomplete>

the autocomplete work correctly when user click on it and then type the input:
the v-menu appear properly
but when user type the input without clicking on v-autocomplete, v-menu does not appear :
v-menu does not appear
however relative events emitted as expected and items are filtered.
surprisingly i tried the same code in vue (not nuxt) and it works properly!

Vishist Varugeese
  • 1,500
  • 1
  • 17
  • 30

1 Answers1

0

I think you can use :

:input-attrs="{'autofocus':true}"

like question below:

https://github.com/paliari/v-autocomplete/issues/27

soroush
  • 742
  • 6
  • 10
  • Thanks Soroush. but it does not work for me. (it seems That doesn't work anymore according to the last comment on this issue page ) – Ali Mirmohamadi Jul 27 '20 at 07:13