Commit b4138675d4ffd8aa2c95c387f87a688ad21ee553

Authored by luffyzhao
1 parent ece49d80

select-binding-0

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
src/components/select/select.vue
@@ -410,8 +410,10 @@ @@ -410,8 +410,10 @@
410 getInitialValue(){ 410 getInitialValue(){
411 const {multiple, value} = this; 411 const {multiple, value} = this;
412 let initialValue = Array.isArray(value) ? value : [value]; 412 let initialValue = Array.isArray(value) ? value : [value];
413 - if (!multiple && (typeof initialValue[0] === 'undefined' || String(initialValue[0]).trim() === '')) initialValue = [];  
414 - return initialValue.filter(Boolean); 413 + if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isfinite(initialValue[0])) )) initialValue = [];
  414 + return initialValue.filter((item) => {
  415 + return Boolean(item) || item === 0
  416 + });
415 }, 417 },
416 processOption(option, values, isFocused){ 418 processOption(option, values, isFocused){
417 if (!option.componentOptions) return option; 419 if (!option.componentOptions) return option;