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

input-number 设置 min 或者 precision 参数后,会在输入过程中不停格式化成错误的值 #3249

Closed
1 task
niceue opened this issue Nov 23, 2020 · 6 comments
Assignees

Comments

@niceue
Copy link

niceue commented Nov 23, 2020

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

Version

2.0.0-rc.1

Environment

win10, Chrome 78, vue3.0.2

Reproduction link

https://2x.antdv.com/components/input-number-cn/#小数

Steps to reproduce

官网案例:小数
输入数字1

What is expected?

输入框不应该格式化,而应该还是 1

What is actually happening?

输入框的值格式化成了 1.0

@zkwolf zkwolf added bug 2.x for 2.x labels Nov 23, 2020
@tangjinzhou tangjinzhou removed 2.x for 2.x bug labels Nov 25, 2020
@tangjinzhou
Copy link
Member

应该只是 文档 有问题,具体使用没问题的

@niceue
Copy link
Author

niceue commented Nov 25, 2020

应该只是 文档 有问题,具体使用没问题的

不是的,是启动开发模式没问题,构建过后的就有问题。

我发现是因为 https://github.com/vueComponent/ant-design-vue/blob/next/components/vc-input-number/src/index.js#L280 这里的

this.setState({
    focused: true,
});

没有生效,导致 onChange 里面 this.inputting 状态没生效,然后导致后面一直不停格式化。应该是 focus 事件的时机问题

开发模式无法重现这个问题,生产模式运行就会有问题

@niceue
Copy link
Author

niceue commented Nov 26, 2020

@tangjinzhou 这个确实是Bug呀,而且还挺严重,用户不可能在开发模式用

@tangjinzhou tangjinzhou added 2.x for 2.x bug and removed docs labels Nov 26, 2020
@tangjinzhou tangjinzhou self-assigned this Nov 26, 2020
@niceue
Copy link
Author

niceue commented Nov 27, 2020

目前临时这样修复了一下
image

tangjinzhou added a commit that referenced this issue Dec 4, 2020
@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants