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

属性

属性类型默认值说明
ariaLabelstringlocale pinInput.labelAccessible name for the group; each cell appends its position to it.
autofocusbooleanfalseFocus 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.
colorKunUIColor"primary"
disabledbooleanfalse
isInvalidbooleanfalseMark every cell invalid (danger ring).
lengthnumber6Number of cells (code length).
maskbooleanfalseRender each filled cell as a • (one-time codes / passcodes).
modelValuestring""
namestring—Native form field name (emits a hidden input mirroring the joined value).
placeholderstring""
roundedKunUIRounded—
sizeKunUISize"md"
type"text" | "numeric""numeric"numeric → digits only + inputmode numeric; text → any single char.

事件

事件回调参数说明
completevalue: stringFired once every cell is filled.
update:modelValuevalue: string