Textarea 文本域
原生 <textarea> 增强,支持高度自适应与尺寸调整。
基础用法
基础用法
行数与尺寸调整
rows / resize
resize 透传原生 resize 值(none / both / horizontal / vertical),默认 none。
高度自适应
autosize
autosize 开启高度自适应:随内容自动增高,空态回到最小高度,超过 max-rows(默认 6)出现滚动条。
自适应边界
autosize + min-rows / max-rows
min-rows(默认 1)控制最小高度,max-rows(默认 6)封顶并出滚动条。旧属性 auto-height 保留兼容。
auto-height 兼容别名
auto-height
auto-height 是 autosize 的兼容别名,行为完全一致:随内容自动增高、空态回到最小行高、超过 max-rows(默认 6)出滚动条。二者任设其一即开启高度自适应。
禁用与只读
disabled / readonly
事件
输入事件
监听 oas-input(输入中,detail: { value }):
API
属性
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
auto-height | 旧属性名(兼容 autosize) | boolean | — |
autosize | 高度自适应 | boolean | — |
disabled | 禁用 | boolean | — |
max-rows | 自适应最大行数 | string | 6 |
min-rows | 自适应最小行数 | string | 1 |
placeholder | 占位提示 | string | — |
readonly | 只读 | boolean | — |
resize | 尺寸调整 | string | — |
rows | 行数 | string | 3 |
value | 值(受控) | string | — |
事件
| 事件 | 说明 |
|---|---|
oas-input | 输入中,detail: { value } |