diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 2d515b22e..297c18f3b 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -478,22 +478,25 @@ setQuery (query) { if (!this.filterable) return; 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; + } + } + }); + } } }, compiled () { - 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; - } - } - }); - } + this.modelToQuery(); this.updateOptions(true); document.addEventListener('keydown', this.handleKeydown); @@ -501,6 +504,7 @@ // watch slot changed if (MutationObserver) { this.observer = new MutationObserver(() => { + this.modelToQuery(); this.slotChange(); this.updateOptions(true, true); }); @@ -521,6 +525,7 @@ }, watch: { model () { + this.modelToQuery(); if (this.multiple) { if (this.slotChangeDuration) { this.slotChangeDuration = false; diff --git a/src/components/tag/tag.vue b/src/components/tag/tag.vue index b0bf01d7b..f600ab4f7 100644 --- a/src/components/tag/tag.vue +++ b/src/components/tag/tag.vue @@ -1,6 +1,6 @@ diff --git a/test/routers/tag.vue b/test/routers/tag.vue index 064959dcb..39f5e8404 100644 --- a/test/routers/tag.vue +++ b/test/routers/tag.vue @@ -40,6 +40,8 @@ true false +

+ 标签一