mirror of https://github.com/ElemeFE/element
Select: get the latest cached option
parent
37ee8e9f88
commit
b5d5922709
|
@ -363,7 +363,13 @@
|
|||
},
|
||||
|
||||
getOption(value) {
|
||||
const option = this.cachedOptions.filter(option => option.value === value)[0];
|
||||
let option;
|
||||
for (let i = 0, len = this.cachedOptions.length; i < len; i++) {
|
||||
const cachedOption = this.cachedOptions[i];
|
||||
if (cachedOption.value === value) {
|
||||
option = cachedOption;
|
||||
}
|
||||
}
|
||||
if (option) return option;
|
||||
const label = typeof value === 'string' || typeof value === 'number'
|
||||
? value : '';
|
||||
|
|
Loading…
Reference in New Issue