Skip to content

InputNumber 数字输入框

InputNumber 组件用于处理数字类型的输入,支持精度控制和范围限制。

参数

Props

名称类型默认值描述
modelValuenumber | null-绑定值
minnumber-Infinity最小值
maxnumberInfinity最大值
precisionnumber-数值精度,小数位数
placeholderstring-占位文本
disabledbooleanfalse是否禁用
readonlybooleanfalse是否只读
clearablebooleanfalse是否可清空
sizeComponentSize'medium'尺寸
status'success' | 'warning' | 'error'-状态样式

Events

名称描述参数
update:modelValue值变化时触发(value: number | null) => void
change值变化时触发(value: number | null, event: Event) => void
focus获取焦点时触发(event: FocusEvent) => void
blur失去焦点时触发(event: FocusEvent) => void
clear点击清除按钮时触发() => void

示例

基础用法

最大值和最小值

精度控制

尺寸

状态

可清空

TypeScript

ts
// 组件尺寸
export type ComponentSize = "small" | "medium" | "large";

// 组件状态
export type ComponentStatus = "success" | "warning" | "error";