Skip to content

Commit

Permalink
Select: remove redundant empty option item when set default value und…
Browse files Browse the repository at this point in the history
…efined single select mode (ElemeFE#15007) (ElemeFE#15111)
  • Loading branch information
susiwen8 authored and Feng committed Jun 20, 2019
1 parent e1f4a46 commit 91996bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/select/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
let option;
const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
const isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
const isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
const cachedOption = this.cachedOptions[i];
Expand All @@ -522,7 +523,7 @@
}
}
if (option) return option;
const label = (!isObject && !isNull)
const label = (!isObject && !isNull && !isUndefined)
? value : '';
let newOption = {
value: value,
Expand Down

0 comments on commit 91996bc

Please sign in to comment.