Skip to content

feat(BootstrapInput): BootstrapInput Bind non-nullable TValue int, float, double, decimal Setting Default Value to Zero When Null #3953

Answered by ArgoZhang
mrtonyguo asked this question in Q&A
Discussion options

You must be logged in to vote

@mrtonyguo 抱歉回复的晚了

绑定类型为不可为空类型

点击组件获取焦点,全选数字,按退格键或者删除键,全部删除时,网页为 null 值,空值对不可为空类型是非法值,所以恢复 500 如果改成 0 这并不合理,可能对某些需求合理

绑定类型为可为空类型

全部删除后网页为 null 值,数值也为 null 值无歧义

总结

歧义是网页返回 null 时,是保持原有值,还是变成绑定类型默认值

这里可以设置一个参数,两种需求都合理。

暂定参数为 AutoSetDefaultWhenNull 默认 false 保持目前行为,设置为 true 时符合你的预期

已发布 v8.7.5

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@TonyGuo16
Comment options

@densen2014
Comment options

@mrtonyguo
Comment options

Answer selected by mrtonyguo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request
4 participants
Converted from issue

This discussion was converted from issue #3931 on July 30, 2024 10:41.