Commit f8620d9ad8f7c7f5f4c85e3af7cea46312797e62
1 parent
427b8692
Fix autocomplete opening/closing
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 | ... | ... |