Merge pull request #3699 from luffyzhao/select-binding-0
解决select 默认数据不能绑定0的情况
This commit is contained in:
commit
d1038fce26
1 changed files with 4 additions and 2 deletions
|
@ -410,8 +410,10 @@
|
||||||
getInitialValue(){
|
getInitialValue(){
|
||||||
const {multiple, value} = this;
|
const {multiple, value} = this;
|
||||||
let initialValue = Array.isArray(value) ? value : [value];
|
let initialValue = Array.isArray(value) ? value : [value];
|
||||||
if (!multiple && (typeof initialValue[0] === 'undefined' || String(initialValue[0]).trim() === '')) initialValue = [];
|
if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isFinite(initialValue[0])))) initialValue = [];
|
||||||
return initialValue.filter(Boolean);
|
return initialValue.filter((item) => {
|
||||||
|
return Boolean(item) || item === 0
|
||||||
|
});
|
||||||
},
|
},
|
||||||
processOption(option, values, isFocused){
|
processOption(option, values, isFocused){
|
||||||
if (!option.componentOptions) return option;
|
if (!option.componentOptions) return option;
|
||||||
|
|
Loading…
Add table
Reference in a new issue