Commit 7db4e70de2478033b2aa72ab106d1a6a274190c7
Committed by
GitHub
1 parent
4e85fa15
Update select.vue
Showing
1 changed file
with
16 additions
and
15 deletions
Show diff stats
src/components/select/select.vue
| @@ -480,23 +480,23 @@ | @@ -480,23 +480,23 @@ | ||
| 480 | this.query = query; | 480 | this.query = query; |
| 481 | }, | 481 | }, |
| 482 | modelToQuery() { | 482 | modelToQuery() { |
| 483 | - if (!this.multiple && this.filterable && this.model) { | ||
| 484 | - this.findChild((child) => { | ||
| 485 | - if (this.model === child.value) { | ||
| 486 | - if (child.label) { | ||
| 487 | - this.query = child.label; | ||
| 488 | - } else if (child.searchLabel) { | ||
| 489 | - this.query = child.searchLabel; | ||
| 490 | - } else { | ||
| 491 | - this.query = child.value; | ||
| 492 | - } | ||
| 493 | - } | ||
| 494 | - }); | ||
| 495 | - } | 483 | + if (!this.multiple && this.filterable && this.model) { |
| 484 | + this.findChild((child) => { | ||
| 485 | + if (this.model === child.value) { | ||
| 486 | + if (child.label) { | ||
| 487 | + this.query = child.label; | ||
| 488 | + } else if (child.searchLabel) { | ||
| 489 | + this.query = child.searchLabel; | ||
| 490 | + } else { | ||
| 491 | + this.query = child.value; | ||
| 492 | + } | ||
| 493 | + } | ||
| 494 | + }); | ||
| 495 | + } | ||
| 496 | } | 496 | } |
| 497 | }, | 497 | }, |
| 498 | compiled () { | 498 | compiled () { |
| 499 | - this.modelToQuery() | 499 | + this.modelToQuery(); |
| 500 | 500 | ||
| 501 | this.updateOptions(true); | 501 | this.updateOptions(true); |
| 502 | document.addEventListener('keydown', this.handleKeydown); | 502 | document.addEventListener('keydown', this.handleKeydown); |
| @@ -504,6 +504,7 @@ | @@ -504,6 +504,7 @@ | ||
| 504 | // watch slot changed | 504 | // watch slot changed |
| 505 | if (MutationObserver) { | 505 | if (MutationObserver) { |
| 506 | this.observer = new MutationObserver(() => { | 506 | this.observer = new MutationObserver(() => { |
| 507 | + this.modelToQuery(); | ||
| 507 | this.slotChange(); | 508 | this.slotChange(); |
| 508 | this.updateOptions(true, true); | 509 | this.updateOptions(true, true); |
| 509 | }); | 510 | }); |
| @@ -524,7 +525,7 @@ | @@ -524,7 +525,7 @@ | ||
| 524 | }, | 525 | }, |
| 525 | watch: { | 526 | watch: { |
| 526 | model () { | 527 | model () { |
| 527 | - this.modelToQuery() | 528 | + this.modelToQuery(); |
| 528 | if (this.multiple) { | 529 | if (this.multiple) { |
| 529 | if (this.slotChangeDuration) { | 530 | if (this.slotChangeDuration) { |
| 530 | this.slotChangeDuration = false; | 531 | this.slotChangeDuration = false; |