18 lines
582 B
Vue
18 lines
582 B
Vue
<script setup lang="ts">
|
|
import { computed, ref } from "vue";
|
|
import { FieldError, Input, Label, TextField } from "@heroui-vue/components";
|
|
|
|
const value = ref("jr");
|
|
const isInvalid = computed(
|
|
() => value.value.length > 0 && value.value.length < 3,
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<TextField v-model="value" class="w-64" :is-invalid="isInvalid">
|
|
<Label for="handle">用户名</Label>
|
|
<Input id="handle" class="bg-field font-mono" placeholder="至少 3 个字符" />
|
|
<FieldError class="font-medium">用户名至少需要 3 个字符</FieldError>
|
|
</TextField>
|
|
</template>
|