Veutify stopping cursor to move when changing isFocused

181 Views Asked by At

Created a code pen where when the user enters text in the first v-autocomplete the dropdown menu for the second v-autocomplete appears. I did with by changing isFocused to true. The issue is the cursor moves to the next v-autocomplete. Is there a way to stop this or another way to show the dropdown menu for the second v-autocomplete?

Here is my code pen https://codepen.io/aaronk488/pen/MWbKNOq?editors=1010

HTML

<div id="app">
<v-app>
    <v-container >
    <v-row >
        <v-col cols="4" md="4">
        <v-autocomplete
            ref="autocomplete"
            label="Autocomplete"
            :items="components"
            :search-input.sync="search"
            hint="need to open menu on focus, just like click"                     persistent-hint
        ></v-autocomplete>
          </v-col>
          <v-col cols="4" md="4">
            <v-autocomplete
            ref="autocomplete2"
            label="Autocomplete2"
            :items="components2"
            hint="need to open menu on focus, just like click this"                     persistent-hint
        ></v-autocomplete>
        </v-col>
    </v-row>
    </v-container>
</v-app>
</div>

JS

new Vue({
  el: "#app",
  vuetify: new Vuetify(),
  data: {
    search: null,
        components: [
          'Autocompletes', 'Comboboxes', 'Forms', 'Inputs', 'Overflow Buttons', 'Selects', 'Selection Controls', 'Sliders', 'Textareas', 'Text Fields',
        ],
            components2: [
          'Autocompletes2', 'Comboboxes2', 'Forms2', 'Inputs2', 'Overflow Buttons2', 'Selects2', 'Selection Controls2', 'Sliders2', 'Textareas2', 'Text Fields2',
        ],
  },
  watch: {
    search(){
      this.$refs.autocomplete2.isMenuActive = true;
      this.$refs.autocomplete2.isFocused = true;
    }
  },
})

Image enter image description here

1

There are 1 best solutions below

0
On

Well, you could use one autocomplete and one select.

But there you go, set this code to search(val) method. I think this is what you searching for.

this.$refs.autocomplete2.$refs.menu.isActive = true;
this.$refs.autocomplete2.blur();

Live example