logo
为了能更好地了解您的商业使用需求,请参与 Ant Design Blazor 商业应用调查,一起建设商业应用社区,为企业系统研发赋能!

InputNumber数字输入框

Examples

数字输入框。

expand code expand code

点击按钮切换可用状态。

expand code expand code

通过 formatter 格式化数字,以展示具有具体含义的数据,往往需要配合 parser 一起使用。

expand code expand code

没有边框。

expand code expand code

value 的精度由 Precision 决定。

expand code expand code

三种大小的数字输入框,当 size 分别为 large 和 small 时,输入框高度为 40px 和 24px ,默认高度为 32px。

expand code expand code

和原生的数字输入框一样,value 的精度由 step 的小数位数决定。

expand code expand code

数字输入框。

expand code expand code

可以设置 CultureInfo 以确保能正确解析字符串。在 Server Side 部署中特别有用。

expand code expand code

InputNumber API#

属性 描述 类型 默认值
Precision 属性用于数字和显示的小数位数 Int32 0
Formatter 属性用于显示的从数字到字符串的格式化程序 Func<TValue, String> --
Format 属性解析器从格式化程序中提取数字 String --
Parser 属性指定从 formatter 中提取的值 Func<String, String> --
Step 属性使用输入箭头将当前值增加或减少到的数字。它可以是整数或小数。 TValue --
DefaultValue 属性初始值 TValue --
Max 属性最大允许数量 TValue --
Min 属性最小允许数量 TValue --
MaxLength 属性最大输入长度 Int32? false
Disabled 属性是否禁用输入 Boolean --
OnChange 属性输入值改变时执行的回调 EventCallback<TValue> --
OnFocus 属性输入获得焦点时执行的回调 EventCallback<FocusEventArgs> --
PlaceHolder 属性占位符值 String --
Bordered 属性是否显示边框 Boolean --
Prefix 属性将前缀内容设置为输入 OneOf<String, RenderFragment> --
Width 属性输入的宽度 String --
ValidationMessages FormItem 的验证消息 String[] --
AdditionalAttributes 属性获取或设置将应用于所创建元素的附加属性的集合。 IReadOnlyDictionary<String, Object> --
Value 属性获取或设置输入的值。这应该与双向绑定一起使用。 TValue --
ValueChanged 属性更新绑定值的回调。 EventCallback<TValue> --
ValueExpression 属性标识绑定值的表达式。 Expression<Func<TValue>> --
ValuesExpression 属性标识可枚举绑定值的表达式。 Expression<Func<IEnumerable<TValue>>> --
Size 属性输入框的大小。注意:在表单的上下文中,使用“大”尺寸。可用:`大``默认``小` String AntSizeLDSType.Default
CultureInfo 属性将字符串转换为值和将值转换为字符串时将使用什么文化对 InputNumber 组件有用。 CultureInfo CultureInfo.CurrentCulture
Id 属性组件 HTML 的 ID String Uniquely Generated ID
Class 属性为 DOM 元素指定一个或多个类名。 String --
Style 属性指定 DOM 元素的内联样式。 String --
RefBack 属性一个 ForwardRef 实例。您可以使用 AntDesign.ForwardRef.Current 获取对内部 DOM 的引用。 ForwardRef --
Input输入框 Mentions提及
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.