Commit 9355bd31 authored by kratsstark's avatar kratsstark Committed by 杨奕

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

parent 43191961
...@@ -512,6 +512,8 @@ ...@@ -512,6 +512,8 @@
getOption(value) { getOption(value) {
let option; let option;
const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]'; 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--) { for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
const cachedOption = this.cachedOptions[i]; const cachedOption = this.cachedOptions[i];
const isEqual = isObject const isEqual = isObject
...@@ -523,7 +525,7 @@ ...@@ -523,7 +525,7 @@
} }
} }
if (option) return option; if (option) return option;
const label = !isObject const label = (!isObject && !isNull)
? value : ''; ? value : '';
let newOption = { let newOption = {
value: value, value: value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment