Select: remove empty option item when default value is null in single mode (#11731)

pull/11702/merge
kratsstark 2018-06-25 12:27:04 +08:00 committed by 杨奕
parent 43191961f6
commit 9355bd3180
1 changed files with 3 additions and 1 deletions

View File

@ -512,6 +512,8 @@
getOption(value) {
let option;
const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
const isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
const cachedOption = this.cachedOptions[i];
const isEqual = isObject
@ -523,7 +525,7 @@
}
}
if (option) return option;
const label = !isObject
const label = (!isObject && !isNull)
? value : '';
let newOption = {
value: value,