Commit c741fa2ff18546ebe90cc6b5e57829a3cc4815d9
1 parent
4f840d27
Use label as query
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
src/components/select/select.vue
... | ... | @@ -423,10 +423,13 @@ |
423 | 423 | }; |
424 | 424 | }, |
425 | 425 | getInitialValue(){ |
426 | - const {multiple, value} = this; | |
426 | + const {multiple, remote, value} = this; | |
427 | 427 | let initialValue = Array.isArray(value) ? value : [value]; |
428 | 428 | if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isFinite(initialValue[0])))) initialValue = []; |
429 | - if (this.remote && !this.multiple && this.value) this.query = value; | |
429 | + if (remote && !multiple && value) { | |
430 | + const data = this.getOptionData(value); | |
431 | + this.query = data ? data.label : String(value); | |
432 | + } | |
430 | 433 | return initialValue.filter((item) => { |
431 | 434 | return Boolean(item) || item === 0; |
432 | 435 | }); | ... | ... |