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

IssueNo: #I7XVG3:[新需求]: Rectify the arkts syntax 3

Description: Rectify the arkts syntax in arkts-extend.md.
Sig: SIG_ApplicaitonFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: N189******51 <lipeicheng5@huawei.com>
上级 12816922
......@@ -64,27 +64,27 @@
- \@Extend装饰的方法的参数可以为function,作为Event事件的句柄。
```ts
@Extend(Text) function makeMeClick(onClick: () => void) {
.backgroundColor(Color.Blue)
.onClick(onClick)
}
@Extend(Text) function makeMeClick(onClick: () => void) {
.backgroundColor(Color.Blue)
.onClick(onClick)
}
@Entry
@Component
struct FancyUse {
@State label: string = 'Hello World';
@Entry
@Component
struct FancyUse {
@State label: string = 'Hello World';
onClickHandler() {
this.label = 'Hello ArkUI';
}
onClickHandler() {
this.label = 'Hello ArkUI';
}
build() {
Row({ space: 10 }) {
Text(`${this.label}`)
.makeMeClick(this.onClickHandler)
build() {
Row({ space: 10 }) {
Text(`${this.label}`)
.makeMeClick(this.onClickHandler)
}
}
}
}
```
- \@Extend的参数可以为[状态变量](arkts-state-management-overview.md),当状态变量改变时,UI可以正常的被刷新渲染。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册