Merge pull request #3897 from SergioCrisostomo/select-patches

Use label as query
This commit is contained in:
Aresn 2018-06-20 09:37:57 +08:00 committed by GitHub
commit 32dc136431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -423,10 +423,13 @@
};
},
getInitialValue(){
const {multiple, value} = this;
const {multiple, remote, value} = this;
let initialValue = Array.isArray(value) ? value : [value];
if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isFinite(initialValue[0])))) initialValue = [];
if (this.remote && !this.multiple && this.value) this.query = value;
if (remote && !multiple && value) {
const data = this.getOptionData(value);
this.query = data ? data.label : String(value);
}
return initialValue.filter((item) => {
return Boolean(item) || item === 0;
});