Keep last selected option index

This commit is contained in:
Sergio Crisostomo 2018-05-11 10:37:01 +02:00
parent 1376a01a72
commit 52cfcd662b

View file

@ -446,7 +446,6 @@
if (this.disabled || this.autoComplete) {
return false;
}
this.focusIndex = -1;
this.visible = typeof force !== 'undefined' ? force : !this.visible;
if (this.visible){
@ -571,6 +570,11 @@
this.hideMenu();
}
this.focusIndex = this.flatOptions.findIndex((opt) => {
if (!opt || !opt.componentOptions) return false;
return opt.componentOptions.propsData.value === option.value;
});
if (this.filterable){
const inputField = this.$el.querySelector('input[type="text"]');
if (!this.autoComplete) this.$nextTick(() => inputField.focus());