PinInput (PIN 输入框)
OTP / PIN 分段输入(v-model 字符串):逐格输入、粘贴分发、掩码、填满触发 complete。
基础用法
值: —
Basic.vue
掩码
Masked.vue
长度与类型
4 位数字
5 位字母数字
LengthType.vue
颜色
primary
secondary
success
warning
danger
info
Colors.vue
尺寸
xs
sm
md
lg
xl
Sizes.vue
状态
无效 (isInvalid)
禁用
States.vue
属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| ariaLabel | string | "验证码" | |
| autofocus | boolean | false | Focus the first cell on mount. Focus is moved with `preventScroll` (see KunInput), so a code field below the fold never yanks the page to itself. |
| color | KunUIColor | "primary" | |
| disabled | boolean | false | |
| isInvalid | boolean | false | Mark every cell invalid (danger ring). |
| length | number | 6 | Number of cells (code length). |
| mask | boolean | false | Render each filled cell as a • (one-time codes / passcodes). |
| modelValue | string | "" | |
| name | string | — | Native form field name (emits a hidden input mirroring the joined value). |
| placeholder | string | "" | |
| rounded | KunUIRounded | — | |
| size | KunUISize | "md" | |
| type | "text" | "numeric" | "numeric" | numeric → digits only + inputmode numeric; text → any single char. |
事件
| 事件 | 回调参数 | 说明 |
|---|---|---|
| complete | value: string | Fired once every cell is filled. |
| update:modelValue | value: string |