Skip to content

文本域

文本域用于输入多行文本。

基础用法

ts
const config = {
  type: 'textarea',
  formItem: {
    label: '备注'
  },
  textarea: {
    placeholder: '请输入备注信息',
    rows: 4,
    maxLength: 500,
    showCount: true
  }
}

API

属性说明类型默认值
rows行数number4
maxLength最大长度number-
showCount是否显示字数统计booleanfalse
allowClear可以点击清除图标删除内容booleanfalse
placeholder输入提示string-
disabled是否禁用booleanfalse
autoSize自适应内容高度boolean | { minRows: number, maxRows: number }false

更多属性请参考 Ant Design Vue Textarea

示例

vue
<script setup lang="ts">
const columns = [
  {
    title: '备注',
    dataIndex: 'remark',
    edit: {
      type: 'textarea',
      formItem: {
        label: '备注信息'
      },
      textarea: {
        rows: 4,
        maxLength: 500,
        showCount: true,
        placeholder: '请输入备注信息'
      }
    }
  },
  {
    title: '描述',
    dataIndex: 'description',
    edit: {
      type: 'textarea',
      formItem: {
        label: '详细描述'
      },
      textarea: {
        autoSize: { minRows: 3, maxRows: 6 },
        placeholder: '请输入详细描述'
      }
    }
  }
]
</script>

根据 Apache-2.0 许可发布。