提交 5a400a58 编写于 作者: H houhaoyu

fixed 9164197f from https://gitee.com/houhaoyu/docs/pulls/22676

houhaoyu@huawei.com
Signed-off-by: Nhouhaoyu <houhaoyu@huawei.com>
Change-Id: Ia4792614c39a2711f6a1a5f1106cfdce582eb240
上级 5783691e
......@@ -63,7 +63,7 @@
- 需注意this指向正确。
以下示例中,Parent组件在调用this.componentBuilder()时,this.label指向其所属组件,即“Parent”。\@Builder componentBuilder()传给子组件\@BuilderParam aBuilder0,在Child组件中调用this.aBuilder0()时,this.label指向在Child的label,即“Child”。
以下示例中,Parent组件在调用this.componentBuilder()时,this.label指向其所属组件,即“Parent”。\@Builder componentBuilder()传给子组件\@BuilderParam aBuilder0,在Child组件中调用this.aBuilder0()时,this.label指向在Child的label,即“Child”。对于\@BuilderParam aBuilder1,在将this.componentBuilder传给aBuilder1时,调用bind绑定了this,因此其this.label指向Parent的label。
> **说明:**
>
......@@ -74,10 +74,12 @@
struct Child {
label: string = `Child`
@BuilderParam aBuilder0: () => void;
@BuilderParam aBuilder1: () => void;
build() {
Column() {
this.aBuilder0()
this.aBuilder1()
}
}
}
......@@ -94,7 +96,7 @@
build() {
Column() {
this.componentBuilder()
Child({ aBuilder0: this.componentBuilder })
Child({ aBuilder0: this.componentBuilder, aBuilder1: this.componentBuilder.bind(this) })
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册