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

Select 选择器回车显示错误的值 #7314

Closed
1 task
StevenTang1994 opened this issue Jan 26, 2024 · 6 comments
Closed
1 task

Select 选择器回车显示错误的值 #7314

StevenTang1994 opened this issue Jan 26, 2024 · 6 comments

Comments

@StevenTang1994
Copy link

StevenTang1994 commented Jan 26, 2024

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

Version

3.2.20

Environment

win10,vue3 Chrome浏览器版本120.0.6099.225

Reproduction link

https://3x.antdv.com/components/select-cn#components-select-demo-tags

Steps to reproduce

<a-select
    ref="select"
    v-model:value="searchFormValueRef.demo"
    style="width: 120px"
    allowClear
>
    <a-select-option value="jack">Jack</a-select-option>
    <a-select-option value="lucy">Lucy</a-select-option>
    <a-select-option value="disabled" disabled>Disabled</a-select-option>
    <a-select-option value="Yiminghe">yiminghe</a-select-option>
</a-select>
<srcipt setup>
import { ref } from 'vue';
const searchFormValueRef = ref({});
</srcipt>

第一步 我点击选择器,选择内容会出来
第二步 不选择任何内容,直接在点击选择器,选择内容会关闭
第三步 按回车,选择器里面有意外的值

What is expected?

按回车之后应该不会有值出现

What is actually happening?

按回车之后会有意外的值


需求是按回车查询表格内容。但是现在遇到,我不选任何值,只是点了一下下拉框,在关闭下拉框,按回车查询,下拉框有意外的值,从而影响查询条件

@qppq54s
Copy link

qppq54s commented Jan 27, 2024

可以把 defaultActiveFirstOption 设置为 false

@jack-7788
Copy link

Snipaste_2024-01-29_10-37-36 将 onInputKeyDown 事件 取消 回车键的默认行为

@StevenTang1994
Copy link
Author

可以把 defaultActiveFirstOption 设置为 false

我设置了allowClear
我随便选中一个值选中之后
在×掉他
在按回车
还是会有意外的值出现

@StevenTang1994
Copy link
Author

Snipaste_2024-01-29_10-37-36 将 onInputKeyDown 事件 取消 回车键的默认行为

请问一下 这个是要改源码吗 我没有找到这段代码

@jack-7788
Copy link

Snipaste_2024-01-29_10-37-36 将 onInputKeyDown 事件 取消 回车键的默认行为

请问一下 这个是要改源码吗 我没有找到这段代码

Snipaste_2024-01-31_11-43-32 组件默认就提供这个事件

@StevenTang1994
Copy link
Author

Snipaste_2024-01-29_10-37-36 将 onInputKeyDown 事件 取消 回车键的默认行为

请问一下 这个是要改源码吗 我没有找到这段代码

Snipaste_2024-01-31_11-43-32 组件默认就提供这个事件

谢谢

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

3 participants