未验证 提交 d9c7d7b7 编写于 作者: O openharmony_ci 提交者: Gitee

!20792 新增TextArea计数器示例代码

Merge pull request !20792 from sunjiakun/master
......@@ -146,6 +146,8 @@ getTextContentLineCount(): number
## 示例
### 示例1
```ts
// xxx.ets
@Entry
......@@ -185,3 +187,41 @@ struct TextAreaExample {
```
![textArea](figures/textArea.gif)
### 示例2
```ts
// xxx.ets
@Entry
@Component
struct TextAreaExample {
@State text: string = 'test'
@State counterVisible: boolean = false
@State maxNumber: number = -1
controller: TextAreaController = new TextAreaController()
build() {
Column() {
TextArea({
text: this.text,
placeholder: 'The text area can hold an unlimited amount of text. input your word...',
controller: this.controller
})
.placeholderFont({ size: 16, weight: 400 })
.width(336)
.height(56)
.margin(20)
.fontSize(16)
.fontColor('#182431')
.maxLength(4)
.showCounter(true)
.backgroundColor('#FFFFFF')
.onChange((value: string) => {
this.text = value
})
}.width('100%').height('100%').backgroundColor('#F1F3F5')
}
}
```
![maxLength](figures/maxLength.png)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册