NumberInput (数字输入框)

数字输入(v-model number|null),带步进按钮、min/max/step、小数精度与自动钳制。

基础用法

Basic.vue

尺寸

Sizes.vue

精度与步长

Precision.vue

范围限制

值: 3

Range.vue

颜色

Colors.vue

状态

数量超出库存

States.vue

无步进按钮

NoControls.vue

属性

属性类型默认值说明
ariaLabelstring""Accessible name, for a field with no visible `label`.
colorKunUIColor"default"Focus-ring accent; the resting border stays neutral.
controlsbooleantrueShow the −/+ stepper buttons (default true).
darkBorderbooleantrueLegacy dark-mode border toggle.
descriptionstring""Helper text below the field (hidden when `error` is set).
disabledbooleanfalseBlocks input and dims the field, steppers included.
errorstring""Error message below the field. Setting it also paints the invalid state and hides `description`.
isInvalidbooleanfalsePaint the invalid state without printing a message — for when the error is shown elsewhere (a form summary).
labelstring""Visible label above the field.
maxnumberNumber.POSITIVE_INFINITYUpper bound. The value is clamped to it, and the + stepper stops there.
minnumberNumber.NEGATIVE_INFINITYLower bound. The value is clamped to it, and the − stepper stops there.
modelValuenumber | nullnullThe numeric value, two-way bound with `v-model`. `null` is the empty field — distinct from `0`.
namestringNative form field name (emits a hidden input mirroring the value).
placeholderstring""Placeholder shown while the field is empty.
precisionnumberRound/display to this many decimal places.
readonlybooleanfalseValue is selectable but not editable, and the steppers do nothing.
requiredbooleanfalseMarks the field required for native validation and assistive tech.
roundedKunUIRoundedCorner radius. Unset follows the app-wide config (default `md`).
sizeKunUISize"md"Height, padding and font size, on the shared form-control scale.
stepnumber1Increment applied by the steppers and by ArrowUp / ArrowDown.

事件

事件回调参数说明
changevalue: number | nullThe committed value — after clamp/precision on blur or a stepper press. `null` when the field is cleared.
update:modelValuevalue: number | null