Element: [Bug Report] el-autocomplete sets clearable to enter no selection again

Created on 26 Sep 2019  ·  4Comments  ·  Source: ElemeFE/element

Element UI version

2.12.0

OS/Browsers version

mac

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/mmx38qxw/

Steps to reproduce

1.输入三出现下拉的建议
2.点击小叉叉 clearable
3.再次输入三不出现下拉的建议选择

What is Expected?

再次输入三 可以出现下拉选择的

What is actually happening?

数据时cb获取到了 要先失去光标 然后再获取广告才能显示出下拉的选择建议项

Most helpful comment

I encountered the issue and wrote the following code as temporary solution. Hope it helps someone.

<el-autocomplete ref="autocomplete" @clear="onClearAutocomplete">
onClearAutocomplete() {
    this.$refs.autocomplete.$children
        .find(c => c.$el.className.includes('el-input'))
        .blur();
    this.$refs.autocomplete.focus();
},

All 4 comments

Translation of this issue:

Element UI version

2.12.0

OS/Browsers version

Mac

Vue version

2.6.10

Reproduction Link

Https://jsfiddle.net/mmx38qxw/

Steps to reproduce

  1. Suggestions for a drop-down in Input 3

  2. Click on the small fork clearable

  3. Enter three again without a drop-down recommendation

What is Expected?

The drop-down selection can occur by re-entering three

What is actually happening?

When the data is available, the CB gets the suggestion that the cursor must be lost before the advertisement can be retrieved to show the drop-down selection.

有方法解决吗

I have this issue too.

I encountered the issue and wrote the following code as temporary solution. Hope it helps someone.

<el-autocomplete ref="autocomplete" @clear="onClearAutocomplete">
onClearAutocomplete() {
    this.$refs.autocomplete.$children
        .find(c => c.$el.className.includes('el-input'))
        .blur();
    this.$refs.autocomplete.focus();
},
Was this page helpful?
0 / 5 - 0 ratings

Related issues

yubo111 picture yubo111  ·  3Comments

smallpath picture smallpath  ·  3Comments

yorululu picture yorululu  ·  3Comments

mochenxm picture mochenxm  ·  3Comments

fscardua picture fscardua  ·  3Comments