|
@@ -266,23 +266,7 @@
|
|
|
this.broadcast('ElOptionGroup', 'queryChange');
|
|
|
}
|
|
|
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
|
|
|
- this.hoverIndex = -1;
|
|
|
- for (let i = 0; i !== this.options.length; ++i) {
|
|
|
- const option = this.options[i];
|
|
|
- if (val) {
|
|
|
- // pick first options that passes the filter
|
|
|
- if (!option.disabled && !option.groupDisabled && option.visible) {
|
|
|
- this.hoverIndex = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- // pick currently selected option
|
|
|
- if (option.itemSelected) {
|
|
|
- this.hoverIndex = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ this.checkDefaultFirstOption();
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -346,6 +330,9 @@
|
|
|
if ([].indexOf.call(inputs, document.activeElement) === -1) {
|
|
|
this.setSelected();
|
|
|
}
|
|
|
+ if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
|
|
|
+ this.checkDefaultFirstOption();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -651,6 +638,26 @@
|
|
|
handleResize() {
|
|
|
this.resetInputWidth();
|
|
|
if (this.multiple) this.resetInputHeight();
|
|
|
+ },
|
|
|
+
|
|
|
+ checkDefaultFirstOption() {
|
|
|
+ this.hoverIndex = -1;
|
|
|
+ for (let i = 0; i !== this.options.length; ++i) {
|
|
|
+ const option = this.options[i];
|
|
|
+ if (this.query) {
|
|
|
+ // pick first options that passes the filter
|
|
|
+ if (!option.disabled && !option.groupDisabled && option.visible) {
|
|
|
+ this.hoverIndex = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // pick currently selected option
|
|
|
+ if (option.itemSelected) {
|
|
|
+ this.hoverIndex = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|