Commit 52cfcd662b78ca2f550c00c35686920dcc13d1b8
1 parent
1376a01a
Keep last selected option index
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
src/components/select/select.vue
... | ... | @@ -446,7 +446,6 @@ |
446 | 446 | if (this.disabled || this.autoComplete) { |
447 | 447 | return false; |
448 | 448 | } |
449 | - this.focusIndex = -1; | |
450 | 449 | |
451 | 450 | this.visible = typeof force !== 'undefined' ? force : !this.visible; |
452 | 451 | if (this.visible){ |
... | ... | @@ -571,6 +570,11 @@ |
571 | 570 | this.hideMenu(); |
572 | 571 | } |
573 | 572 | |
573 | + this.focusIndex = this.flatOptions.findIndex((opt) => { | |
574 | + if (!opt || !opt.componentOptions) return false; | |
575 | + return opt.componentOptions.propsData.value === option.value; | |
576 | + }); | |
577 | + | |
574 | 578 | if (this.filterable){ |
575 | 579 | const inputField = this.$el.querySelector('input[type="text"]'); |
576 | 580 | if (!this.autoComplete) this.$nextTick(() => inputField.focus()); |
... | ... |