Skip to content

A2UI 文本域 Textarea

通过 Schema 配置生成 XTextarea 多行文本域组件。

字段配置

json
{
  "name": "bio",
  "label": "简介",
  "type": "textarea",
  "props": {
    "placeholder": "请输入简介",
    "rows": 4,
    "maxlength": 500,
    "showWordLimit": true,
    "autosize": { "minRows": 2, "maxRows": 6 }
  },
  "rules": [
    { "type": "required", "message": "简介必填" }
  ]
}

Props 配置

属性类型默认值说明
placeholderstring-占位文本
rowsnumber2默认行数
maxlengthnumber-最大输入长度
showWordLimitbooleanfalse显示字数统计
autosizeobject/booleanfalse自适应高度
disabledbooleanfalse禁用状态
resizestring'vertical'resize 属性

autosize 配置

json
"autosize": { "minRows": 2, "maxRows": 8 }

示例

基础文本域

json
{ "name": "content", "label": "内容", "type": "textarea" }

自适应高度

json
{ "name": "description", "label": "描述", "type": "textarea", "props": { "autosize": true } }

带字数限制

json
{ "name": "comment", "label": "评论", "type": "textarea", "props": { "maxlength": 200, "showWordLimit": true } }

渲染组件

A2UI Textarea 字段会渲染为 XTO UI 的 XTextarea 组件:

vue
<XTextarea
  v-model="formData.bio"
  placeholder="请输入简介"
  :rows="4"
/>

相关链接

基于 MIT 许可发布