diff --git a/examples/routers/select.vue b/examples/routers/select.vue index 6900d5b..6560602 100644 --- a/examples/routers/select.vue +++ b/examples/routers/select.vue @@ -53,33 +53,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file + diff --git a/src/components/select/option.vue b/src/components/select/option.vue index 1adf7d9..8dc2308 100644 --- a/src/components/select/option.vue +++ b/src/components/select/option.vue @@ -63,10 +63,14 @@ queryChange (val) { const parsedQuery = val.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1'); this.hidden = !new RegExp(parsedQuery, 'i').test(this.searchLabel); + }, + // 在使用函数防抖后,设置 key 后,不更新组件了,导致SearchLabel 不更新 #1865 + updateSearchLabel () { + this.searchLabel = this.$el.innerHTML; } }, mounted () { - this.searchLabel = this.$el.innerHTML; + this.updateSearchLabel(); this.dispatch('iSelect', 'append'); this.$on('on-select-close', () => { this.isFocus = false; diff --git a/src/components/select/select.vue b/src/components/select/select.vue index bd132cf..9410537 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -627,6 +627,7 @@ this.$nextTick(() => this.broadcastQuery('')); } else { this.findChild((child) => { + child.updateSearchLabel(); // #1865 child.selected = this.multiple ? this.model.indexOf(child.value) > -1 : this.model === child.value; }); } -- libgit2 0.21.4