TextInput&TestArea组件基本介绍

64 阅读1分钟

在日常中,少不了用户进行输入的时候,所以这个时候就可以使用输入组件来完成。

image.png

1.TextInput

单行的输入框组件

  • 它的一些常用参数:

image.png

  • 常用属性

image.png

说明:它的输入格式有密码Password类型,邮箱地址输入模式Email类型,以及经常使用的数字类型number,他们都是枚举值

语法:

TextInput(value?:{placeholder?:ResourceStr,text?:ResourceStr,controller?: TextInputController})

1.2.TextArea

它是用来进行多行输入的,但是用法跟TextInput的用法基本上是一致的。

语法:

TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: TextAreaController})

它的常用参数是跟TextInput差不多,所以重点来看一下常用属性,

image.png

说明:其中的showCounter和maxLength要搭配起使用。