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

IssueNo: #I7X5WW:[新需求]: Rectify the arkts syntax of qs

Description: Rectify the arkts syntax of qs
Sig: SIG_ApplicaitonFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: N189******51 <lipeicheng5@huawei.com>
上级 02ff7309
...@@ -77,13 +77,22 @@ MyGlobalBuilderFunction() ...@@ -77,13 +77,22 @@ MyGlobalBuilderFunction()
```ts ```ts
ABuilder( $$ : { paramA1: string, paramB1 : string } ); class ABuilderParam {
paramA1: string = ''
paramB1: string = ''
}
ABuilder($$ : ABuilderParam);
``` ```
```ts ```ts
@Builder function ABuilder($$: { paramA1: string }) { class ABuilderParam {
paramA1: string = ''
}
@Builder function ABuilder($$: ABuilderParam) {
Row() { Row() {
Text(`UseStateVarByReference: ${$$.paramA1} `) Text(`UseStateVarByReference: ${$$.paramA1} `)
} }
...@@ -94,10 +103,10 @@ struct Parent { ...@@ -94,10 +103,10 @@ struct Parent {
@State label: string = 'Hello'; @State label: string = 'Hello';
build() { build() {
Column() { Column() {
// 在Parent组件中调用ABuilder的时候,将this.label引用传递给ABuilder // Pass the this.label reference to the ABuilder component when the ABuilder component is called in the Parent component.
ABuilder({ paramA1: this.label }) ABuilder({ paramA1: this.label })
Button('Click me').onClick(() => { Button('Click me').onClick(() => {
// 点击“Click me”后,UI从“Hello”刷新为“ArkUI” // After Click me is clicked, the UI text changes from Hello to ArkUI.
this.label = 'ArkUI'; this.label = 'ArkUI';
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册