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

AutoComplete 回车bug #7971

Open
1 task done
clddup opened this issue Dec 7, 2024 · 3 comments
Open
1 task done

AutoComplete 回车bug #7971

clddup opened this issue Dec 7, 2024 · 3 comments

Comments

@clddup
Copy link
Contributor

clddup commented Dec 7, 2024

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

chrome 131.0.6778.109, vue ^3.4.29

Reproduction link

https://github.com/clddup/antdv-auto-complete-bug

Steps to reproduce

  1. 输入框输入文本后,出现提示文本列表
  2. 通过键盘向下选择第二个或第三个, 回车,此时,输入框内值被更新
  3. 这个时候为了防止下次输入框获取焦点还出现提示文本列表, 我会清空文本列表
  4. 再次点击回车想进行我的搜索事件,请求远端api(为了简化实例, 没有写这个步骤)
  5. 此时输入框的值会被自动更新为 文本提示列表的第一项, 但是我上面第三步已经清空了提示列表

What is expected?

期望我回车时候 不修改我的值改为之前提示列表第一项, 因为这时候我的提示列表是空的

What is actually happening?

我的输入框值被改为了之前 提示列表第一项

@clddup
Copy link
Contributor Author

clddup commented Dec 7, 2024

antdv-auto-complete-bug

@TsMask
Copy link

TsMask commented Dec 9, 2024

我也发现了,但是v3的版本不会这样子

  1. 输入1234点击键盘回车,将字符串发出完成后将绑定值设置为""
  2. 再次鼠标键入点击回车,它又把历史options给发出去了

@clddup
Copy link
Contributor Author

clddup commented Dec 9, 2024

我也发现了,但是v3的版本不会这样子

  1. 输入1234点击键盘回车,将字符串发出完成后将绑定值设置为""
  2. 再次鼠标键入点击回车,它又把历史options给发出去了

我目前的解决方案是吧 defaultActiveFirstOption 设置为 false, 不会触发这个bug

clddup added a commit to clddup/ant-design-vue that referenced this issue Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants