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
<InputNumber /> onChange 事件触发后表现不一致 #4265
Comments
这里还有一个bug。如果我不blur,直接在input框中输入 1 然后点击提交按钮,目前是不会触发传给form的 |
点击提交按钮是,应该会触发 blur 的。 |
我的按钮没有放到form组件中,并没有触发。 |
@luckyyang 最好给个最简的在线例子方便重现和调试,我看你的文字描述貌似有点自相矛盾。 |
@afc163 你们有redux的模板么,我是在redux项目中发现这个问题的。 我看到blur确实被触发了,redux也接收到了变化后的值。只是问题是,我提交按钮按下后,无法保证使用的值是变化后的值 |
另外,为什么不让InputNumber也触发onChange事件呢? 如果触发onChange 事件,就不会有这个问题了 |
因为有可能输入非数字,InputNumber 目前的实现是 onChange 只输出数字值,非数字输入在 blur 时会清除。 |
而实际情况是,直接手动输入值,并不会触发onChange。用户会认为这个是bug |
手动输入后,blur 时才会触发 onChange。 |
请问这样的情况如何解决呢 |
提交按钮按下前,InputNumber 的 blur 是会先触发的,我本地测试了『用户手动输入数值 + 然后直接点击确定按钮』能拿到。你的问题能否尝试给我个重现,方便调试和修复。 |
要复现的话,我需要单独做一个项目出来,稍等等 |
麻烦了。 |
升级了 rc-input-number,修正成用户输入,blur 时都会触发 onChange。 |
@afc163 👍 你们啥时候升级antd ? 我觉得这样才好,也省的我发那个麻烦的redux demo了 |
@afc163 Why is this closed? Even though Could you please bump up the version number? |
That will be released in |
Thanks a lot. |
@afc163 Sorry to bug you again with this, but antd has moved to |
@RaoHai We can release 2.7.0 now. |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
<InputNumber />
组件在触发 onChange 事件时表现不一致,导致在 onBlur 事件里可能无法获取到最新的状态。如下图,查看demo
是否可以考虑在mixin.js#L76加个定时器,避免这种现象?
The text was updated successfully, but these errors were encountered: