Commit 2d1b86d4d7a08ccb0c50e140f067ad476c2cce02
Committed by
GitHub
Merge pull request #3753 from SergioCrisostomo/autocomplete-patches
Change logic for hiding AutoComplete panel
Showing
2 changed files
with
4 additions
and
6 deletions
Show diff stats
src/components/auto-complete/auto-complete.vue
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | :placeholder="placeholder" |
9 | 9 | :size="size" |
10 | 10 | :placement="placement" |
11 | + :value="currentValue" | |
11 | 12 | filterable |
12 | 13 | remote |
13 | 14 | auto-complete |
... | ... | @@ -146,22 +147,19 @@ |
146 | 147 | }, |
147 | 148 | handleChange (val) { |
148 | 149 | this.currentValue = val; |
149 | - this.$refs.select.model = val; | |
150 | 150 | this.$refs.input.blur(); |
151 | 151 | this.$emit('on-select', val); |
152 | 152 | }, |
153 | 153 | handleFocus (event) { |
154 | - this.$refs.select.visible = true; | |
155 | 154 | this.$emit('on-focus', event); |
156 | 155 | }, |
157 | 156 | handleBlur (event) { |
158 | - this.$refs.select.visible = false; | |
159 | 157 | this.$emit('on-blur', event); |
160 | 158 | }, |
161 | 159 | handleClear () { |
162 | 160 | if (!this.clearable) return; |
163 | 161 | this.currentValue = ''; |
164 | - this.$refs.select.model = ''; | |
162 | + this.$refs.select.reset(); | |
165 | 163 | } |
166 | 164 | } |
167 | 165 | }; | ... | ... |
src/components/select/select.vue
... | ... | @@ -346,7 +346,7 @@ |
346 | 346 | const selectedSlotOption = autoCompleteOptions[currentIndex]; |
347 | 347 | |
348 | 348 | return slotOptions.map(node => { |
349 | - if (node === selectedSlotOption) return applyProp(node, 'isFocused', true); | |
349 | + if (node === selectedSlotOption || getNestedProperty(node, 'componentOptions.propsData.value') === this.value) return applyProp(node, 'isFocused', true); | |
350 | 350 | return copyChildren(node, (child) => { |
351 | 351 | if (child !== selectedSlotOption) return child; |
352 | 352 | return applyProp(child, 'isFocused', true); |
... | ... | @@ -467,7 +467,7 @@ |
467 | 467 | }, |
468 | 468 | |
469 | 469 | toggleMenu (e, force) { |
470 | - if (this.disabled || this.autoComplete) { | |
470 | + if (this.disabled) { | |
471 | 471 | return false; |
472 | 472 | } |
473 | 473 | ... | ... |