41 lines
1008 B
Vue
41 lines
1008 B
Vue
<script setup lang="ts">
|
||
import {
|
||
Description,
|
||
InputOTP,
|
||
InputOTPGroup,
|
||
InputOTPSeparator,
|
||
InputOTPSlot,
|
||
Label,
|
||
REGEXP_ONLY_CHARS,
|
||
} from "@heroui-vue/components";
|
||
|
||
import { useId } from "vue";
|
||
const otpDescriptionId = useId();
|
||
const otpLabelId = useId();
|
||
</script>
|
||
|
||
<template>
|
||
<div class="flex w-[280px] flex-col gap-2">
|
||
<Label :id="otpLabelId">输入验证码(仅字母)</Label>
|
||
<Description :id="otpDescriptionId">仅允许输入字母</Description>
|
||
<InputOTP
|
||
:aria-describedby="otpDescriptionId"
|
||
:aria-labelledby="otpLabelId"
|
||
:max-length="6"
|
||
:pattern="REGEXP_ONLY_CHARS"
|
||
>
|
||
<InputOTPGroup>
|
||
<InputOTPSlot :index="0" />
|
||
<InputOTPSlot :index="1" />
|
||
<InputOTPSlot :index="2" />
|
||
</InputOTPGroup>
|
||
<InputOTPSeparator />
|
||
<InputOTPGroup>
|
||
<InputOTPSlot :index="3" />
|
||
<InputOTPSlot :index="4" />
|
||
<InputOTPSlot :index="5" />
|
||
</InputOTPGroup>
|
||
</InputOTP>
|
||
</div>
|
||
</template>
|