未验证 提交 78ae4896 编写于 作者: 1 189******51 提交者: Gitee

update zh-cn/application-dev/quick-start/arkts-declarative-ui-description.md.

Signed-off-by: N189******51 <lipeicheng5@huawei.com>
上级 bce252b8
......@@ -116,13 +116,13 @@ Column() {
})
```
- 使用匿名函数表达式配置组件的事件方法,要求使用bind,以确保函数体中的this指向当前组件
- 使用匿名函数表达式配置组件的事件方法,要求使用“() => {...}”,以确保函数与组件绑定,同时符合ArtTS语法规范
```ts
Button('add counter')
.onClick(function(){
.onClick(() => {
this.counter += 2;
}.bind(this))
})
```
- 使用组件的成员函数配置组件的事件方法。
......@@ -133,7 +133,7 @@ Column() {
}
...
Button('add counter')
.onClick(this.myClickHandler.bind(this))
.onClick(this.myClickHandler)
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册