We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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虽然支持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,避免精度丢失)
type='number'
type='digit'
[Vue warn]: Invalid prop: type check failed for prop "modelValue".
string | number
modelValue
update:modelValue
input的modelValue的类型建议支持number
The text was updated successfully, but these errors were encountered:
feat: input的modelValue的类型支持number(jdf2e#2635)
9793bb5
feat(input): modelValue 支持 number 类型 (#2635) (#2638)
a239dc4
Successfully merging a pull request may close this issue.
这个功能解决了什么问题?
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
The text was updated successfully, but these errors were encountered: