diff --git a/src/components/select/functional-options.vue b/src/components/select/functional-options.vue index a319709..39783bd 100644 --- a/src/components/select/functional-options.vue +++ b/src/components/select/functional-options.vue @@ -18,11 +18,17 @@ }, }, functional: true, - render(h, {props, parent}){ - // to detect changes in the $slot children/options we do this hack - // so we can trigger the parents computed properties and have everything reactive - // although $slot.default is not - if (props.slotOptions !== parent.$slots.default) props.slotUpdateHook(); + render(h, {props, parent}) { + // In order to response data changes,i do this hack. #4372 + if(props.slotOptions.length > 0) { + for(let i in props.slotOptions) { + if(props.slotOptions[i].key !== parent.$slots.default[i].key) { + props.slotUpdateHook(); + break; + } + } + } + if(props.slotOptions && parent.$slots.default && props.slotOptions.length !== parent.$slots.default.length) props.slotUpdateHook(); return props.options; } }; diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 012fb93..52f5d13 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -635,6 +635,9 @@ }, updateSlotOptions(){ this.slotOptions = this.$slots.default; + // #4372 issue, i find that this.query's value affects the judgment of the validateOption method. + this.query = ''; + this.focusIndex = -1; }, checkUpdateStatus() { if (this.getInitialValue().length > 0 && this.selectOptions.length === 0) { -- libgit2 0.21.4