2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-13 08:32:26 +03:00

fix: existing options should be selected with taggable (#1124)

Closes #1121
This commit is contained in:
Jeff Sagal
2020-03-20 09:31:59 -07:00
committed by GitHub
parent 8e061ce1af
commit f90a14470b
2 changed files with 21 additions and 6 deletions
+7 -5
View File
@@ -56,16 +56,18 @@ export default {
* Optionally clear the search input on selection.
* @return {void}
*/
typeAheadSelect () {
if (!this.taggable && this.filteredOptions[this.typeAheadPointer]) {
this.select(this.filteredOptions[this.typeAheadPointer]);
typeAheadSelect() {
const typeAheadOption = this.filteredOptions[this.typeAheadPointer];
if (typeAheadOption) {
this.select(typeAheadOption);
} else if (this.taggable && this.search.length) {
this.select(this.createOption(this.search));
}
if (this.clearSearchOnSelect) {
this.search = '';
this.search = "";
}
},
}
}
}