Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] el-autocomplete 设置 clearable 后,点击清除后,再次搜索无法出现搜索下拉框 #19050

Open
ckisme opened this issue Mar 25, 2020 · 5 comments

Comments

@ckisme
Copy link

ckisme commented Mar 25, 2020

Element UI version

2.13.0

OS/Browsers version

Windows 64 / Chrome

Vue version

2.6.11

Reproduction Link

https://github.com/ElemeFE/

Steps to reproduce

el-autocomplete 设置 clearable 后,输入一段文字,然后点击iinput的清除按钮后,input内容可清除,但再次输入文本搜索,能发送http请求,但无法出现搜索下拉框

What is Expected?

每次请求调用callback都需要把下拉框的显示出来

What is actually happening?

无法出现搜索下拉框

@scscms
Copy link

scscms commented Mar 26, 2020

bug源于点击清空按钮后会执行this.activated = false,而执行this.activated = true是在输入框再次获取焦点后。所以需要你失去焦点再次让输入框获取焦点。
个人认为其实这个不需要判断是否激动,只要判断输入框内容在变化就触发搜索即可,想多了。

@anming-john
Copy link

我也遇到这个问题,有办法解决吗??

tomieric added a commit to tomieric/element that referenced this issue Oct 20, 2021
@tianxia0079
Copy link

怎么修复的呀,升级到最新版本了,还是有这个问题

@tianxia0079
Copy link

tianxia0079 commented Nov 8, 2021

怎么修复的呀,升级到最新版本了,还是有这个问题

临时修复方法:
开启slot

                       <template slot="suffix" v-if="searchInput.length>0">
                            <i class="el-input__icon el-icon-circle-close el-input__clear" @click="aaiClear"></i>
                        </template>
 
再自定义一个方法
 
 aaiClear: function () {
                this.searchInput = '';//这里的searchInput 是绑定的值
            },

@guohuihot
Copy link

guohuihot commented Nov 6, 2023

clear() {
  // 修复clear后,再次输入不能弹出下拉框
      this.$refs.input.blur()
      this.$nextTick(() => {
        this.$refs.input.focus()
      })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants