# textarea

多行输入框。该组件是原生组件,样式和行为和 HTML 有所差异,不允许嵌套其他组件,使用时请注意相关限制。

# 属性

属性 类型 默认值 必填 说明
name string 在表单中的字段名
value string '' 输入框的内容
maxlength number 140 最大输入长度,设置为 -1 的时候不限制最大长度
disabled boolean false 是否禁用
placeholder string '' 输入框为空时占位符
placeholder-style string '' 指定 placeholder 的样式,目前仅支持 color , font-size 和 font-weight
auto-focus boolean false 自动聚焦,拉起键盘。
focus boolean false 获取焦点
fixed boolean false 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true
cursor-color string '#FE3666' 光标默认色, 目前支持hex颜色码
auto-height boolean false 是否自动增高,设置 auto-height 时,style.height 不生效
confirm-type 'search' | 'send' | 'next' | 'go' | 'done' | 'return' 'return' 设置键盘右下角按钮的文字

# confirmType

设置键盘右下角按钮的文字

说明
'search' 右下角按钮为“搜索”
'send' 右下角按钮为“发送”
'next' 右下角按钮为“下一个”
'go' 右下角按钮为“前往”
'done' 右下角按钮为“完成”
'return' 右下角按钮为“换行”
  1. tip: textarea 的 blur 事件会晚于页面上的 tap 事件,如果需要在 button 的点击事件获取 textarea,可以使用 form 的 bindsubmit。
  2. tip: 不建议在多行文本上对用户的输入进行修改,所以 textarea 的 bindinput 处理函数并不会将返回值反映到 textarea 上。
  3. tip: 键盘高度发生变化,keyboardheightchange 事件可能会多次触发,开发者对于相同的 height 值应该忽略掉

# 扫码体验

# 示例代码

Copyright ©2024, All Rights Reserved