Merge pull request #5116 from RookieZoe/2.select

[select] fix script error when searching in select component
This commit is contained in:
Aresn 2019-01-07 16:16:19 +08:00 committed by GitHub
commit 8857d163b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -560,8 +560,14 @@
if (e.key === 'Enter') {
if (this.focusIndex === -1) return this.hideMenu();
const optionComponent = this.flatOptions[this.focusIndex];
// fix a script error when searching
if (optionComponent) {
const option = this.getOptionData(optionComponent.componentOptions.propsData.value);
this.onOptionClick(option);
} else {
this.hideMenu();
}
}
} else {
const keysThatCanOpenSelect = ['ArrowUp', 'ArrowDown'];