[Vuejs]-Keep the dropdown down after selected in Element (Vue) Autocomplete

0👍

There is no reasonable way to do that without forking the library or writing your own component.

Here is the code in elements source that always closes the autocomplete when a choice is selected:

select(item) {
  this.$emit('input', item[this.valueKey]);
  this.$emit('select', item);
  this.$nextTick(_ => {
    this.suggestions = []; // This will always close the suggestions tooltip
    this.highlightedIndex = -1;
  });
}

Source.

If you don’t want to fork the whole library and you are importing the components individually, you may be able to 1. import the el-autocomplete component, 2. overwrite the select method, 3. register the modified component.

Leave a comment