From 7db4e70de2478033b2aa72ab106d1a6a274190c7 Mon Sep 17 00:00:00 2001 From: YikaJ <547179699@qq.com> Date: Thu, 9 Feb 2017 20:01:50 +0800 Subject: [PATCH] Update select.vue --- src/components/select/select.vue | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 6a524aac..297c18f3 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -480,23 +480,23 @@ this.query = query; }, modelToQuery() { - if (!this.multiple && this.filterable && this.model) { - this.findChild((child) => { - if (this.model === child.value) { - if (child.label) { - this.query = child.label; - } else if (child.searchLabel) { - this.query = child.searchLabel; - } else { - this.query = child.value; - } - } - }); - } + if (!this.multiple && this.filterable && this.model) { + this.findChild((child) => { + if (this.model === child.value) { + if (child.label) { + this.query = child.label; + } else if (child.searchLabel) { + this.query = child.searchLabel; + } else { + this.query = child.value; + } + } + }); + } } }, compiled () { - this.modelToQuery() + this.modelToQuery(); this.updateOptions(true); document.addEventListener('keydown', this.handleKeydown); @@ -504,6 +504,7 @@ // watch slot changed if (MutationObserver) { this.observer = new MutationObserver(() => { + this.modelToQuery(); this.slotChange(); this.updateOptions(true, true); }); @@ -524,7 +525,7 @@ }, watch: { model () { - this.modelToQuery() + this.modelToQuery(); if (this.multiple) { if (this.slotChangeDuration) { this.slotChangeDuration = false;