Skip to content

验证码 VerifyCode

用于固定长度的验证码或者支付密码输入,提升用户输入体验。

基础用法

验证码输入框的基础用法。

vue
<template>
  <bp-verify-code v-model="code"></bp-verify-code>
</template>

<script setup lang="ts">
import { ref } from "vue";
const code = ref<string>("");
</script>

密文输入

通过设置 type 属性为 password 开启密文输入。

vue
<template>
  <bp-verify-code type="password" v-model="code"></bp-verify-code>
</template>

<script setup lang="ts">
import { ref } from "vue";
const code = ref<string>("123456");
</script>

不同状态

和输入框一样,支持 disabledreadonly 两种状态。

vue
<template>
  <bp-space type="vertical">
    <bp-verify-code disabled v-model="code"></bp-verify-code>
    <bp-verify-code readonly v-model="code"></bp-verify-code>
  </bp-space>
</template>

<script setup lang="ts">
import { ref } from "vue";
const code = ref<string>("123456");
</script>

VerifyCode 属性

v-model绑定值
String
--
name输入框名称
String
--
type输入框类型
InputType
text-
placeholder占位文本
String
--
size输入框尺寸
InputSize
default-
length验证码长度
Number
6-
disabled是否禁用
Boolean
false-
readonly是否只读
Boolean
false-

VerifyCode 事件

finish输入完成触发--