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

[FR]: input的modelValue的类型建议支持number #2635

Closed
wmz46 opened this issue Nov 4, 2023 · 0 comments · Fixed by #2638
Closed

[FR]: input的modelValue的类型建议支持number #2635

wmz46 opened this issue Nov 4, 2023 · 0 comments · Fixed by #2638
Labels
Feature Request 新功能请求

Comments

@wmz46
Copy link

wmz46 commented Nov 4, 2023

这个功能解决了什么问题?

input虽然支持type='number'type='digit' ,绑定number类型的值也可以正常运行,但在开发模式下运行时会有警告[Vue warn]: Invalid prop: type check failed for prop "modelValue".
主流ui库中对于input的modelValue类型一般都支持 string | number,建议有条件还是优化下。
以下是我觉得可以修改的方式:
1.简单处理可能就修改下modelValue的定义。这样绑定值可以是number,用户如果有修改则变成string。
2.复杂点处理可能还需要在update:modelValue时重新根据type转换成对应类型,以避免input在用户修改后绑定值类型变动。(当然,由于js的限制,大数字可能需要特殊处理,依旧还是string,避免精度丢失)

你期望的组件设计是怎样的?

input的modelValue的类型建议支持number

@wmz46 wmz46 added the Feature Request 新功能请求 label Nov 4, 2023
yi-boide added a commit to yi-boide/nutui that referenced this issue Nov 6, 2023
@eiinu eiinu linked a pull request Nov 6, 2023 that will close this issue
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request 新功能请求
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant