未验证 提交 645c0b02 编写于 作者: 耿文广 提交者: Gitee

!4 update zh-cn/application-dev/quick-start/arkts-builderparam.md.

Merge pull request !4 from 189******51/N/A
...@@ -34,34 +34,34 @@ ...@@ -34,34 +34,34 @@
- 用父组件自定义构建函数初始化子组件\@BuildParam装饰的方法。 - 用父组件自定义构建函数初始化子组件\@BuildParam装饰的方法。
```ts ```ts
@Component @Component
struct Child { struct Child {
@Builder componentBuilder() { @Builder componentBuilder() {
Text(`Parent builder `) Text(`Parent builder `)
} }
@BuilderParam aBuilder0: () => void = this.componentBuilder; @BuilderParam aBuilder0: () => void = this.componentBuilder;
build() { build() {
Column() { Column() {
this.aBuilder0() this.aBuilder0()
}
} }
} }
}
@Entry @Entry
@Component @Component
struct Parent { struct Parent {
@Builder componentBuilder() { @Builder componentBuilder() {
Text(`Parent builder `) Text(`Parent builder `)
} }
build() { build() {
Column() { Column() {
Child({ aBuilder0: this.componentBuilder }) Child({ aBuilder0: this.componentBuilder })
}
} }
} }
}
``` ```
...@@ -74,40 +74,40 @@ struct Parent { ...@@ -74,40 +74,40 @@ struct Parent {
> 开发者谨慎使用bind改变函数调用的上下文,可能会使this指向混乱。 > 开发者谨慎使用bind改变函数调用的上下文,可能会使this指向混乱。
```ts ```ts
@Component @Component
struct Child { struct Child {
@Builder componentBuilder() { @Builder componentBuilder() {
Text(`Child builder `) Text(`Child builder `)
} }
label: string = `Child` label: string = `Child`
@BuilderParam aBuilder0: () => void = this.componentBuilder; @BuilderParam aBuilder0: () => void = this.componentBuilder;
@BuilderParam aBuilder1: () => void = this.componentBuilder; @BuilderParam aBuilder1: () => void = this.componentBuilder;
build() { build() {
Column() { Column() {
this.aBuilder0() this.aBuilder0()
this.aBuilder1() this.aBuilder1()
}
} }
} }
}
@Entry @Entry
@Component @Component
struct Parent { struct Parent {
label: string = `Parent` label: string = `Parent`
@Builder componentBuilder() { @Builder componentBuilder() {
Text(`${this.label}`) Text(`${this.label}`)
} }
build() { build() {
Column() { Column() {
this.componentBuilder() this.componentBuilder()
Child({ aBuilder0: this.componentBuilder, aBuilder1: this.componentBuilder }) Child({ aBuilder0: this.componentBuilder, aBuilder1: this.componentBuilder })
}
} }
} }
}
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册