组件
字段 Field
Field:表单字段。提供带字距的 label、边框加聚焦光晕的控件,以及低调的帮助文本。部件:Root、Label、Input、Textarea、Select、HelperText、ErrorText、RequiredIndicator。
#基础用法
Shown beside your published notes.
<script setup lang="ts">
import { Field } from "@bysages/vue";
</script>
<template>
<Field.Root required>
<Field.Label>
Display name
<Field.RequiredIndicator>*</Field.RequiredIndicator>
</Field.Label>
<Field.Input placeholder="How you sign your work" />
<Field.HelperText>Shown beside your published notes.</Field.HelperText>
</Field.Root>
</template>
#属性
#ErrorText
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#HelperText
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Input
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
modelValue | InputHTMLAttributes['value'] | — |
#Item
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
value | string | — |
#Label
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#RequiredIndicator
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Root
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
disabled | boolean | 是否禁用字段 | |
id | string | 字段的 id | |
ids | ElementIds | 字段各部件的 id | |
invalid | boolean | 字段是否无效 | |
readOnly | boolean | 字段是否只读 | |
required | boolean | 字段是否必填 | |
target | string | 标签指向的目标字段项值 |
#Select
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
modelValue | SelectHTMLAttributes['value'] | — |
#Textarea
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
autoresize | boolean | false | 文本域是否自动调整高度 |
modelValue | TextareaHTMLAttributes['value'] | — |