From 0572a61392044689692cc7460d6633ed6c494013 Mon Sep 17 00:00:00 2001 From: 189******51 Date: Mon, 4 Sep 2023 09:22:00 +0000 Subject: [PATCH] update zh-cn/application-dev/quick-start/arkts-builderparam.md. Signed-off-by: 189******51 --- .../quick-start/arkts-builderparam.md | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/zh-cn/application-dev/quick-start/arkts-builderparam.md b/zh-cn/application-dev/quick-start/arkts-builderparam.md index 8151b6e8eb..9e1ca6bc87 100644 --- a/zh-cn/application-dev/quick-start/arkts-builderparam.md +++ b/zh-cn/application-dev/quick-start/arkts-builderparam.md @@ -34,34 +34,34 @@ - 用父组件自定义构建函数初始化子组件\@BuildParam装饰的方法。 ```ts -@Component -struct Child { - @Builder componentBuilder() { - Text(`Parent builder `) - } + @Component + struct Child { + @Builder componentBuilder() { + Text(`Parent builder `) + } - @BuilderParam aBuilder0: () => void = this.componentBuilder; + @BuilderParam aBuilder0: () => void = this.componentBuilder; - build() { - Column() { - this.aBuilder0() + build() { + Column() { + this.aBuilder0() + } } } -} -@Entry -@Component -struct Parent { - @Builder componentBuilder() { - Text(`Parent builder `) - } + @Entry + @Component + struct Parent { + @Builder componentBuilder() { + Text(`Parent builder `) + } - build() { - Column() { - Child({ aBuilder0: this.componentBuilder }) + build() { + Column() { + Child({ aBuilder0: this.componentBuilder }) + } } } -} ``` @@ -74,40 +74,40 @@ struct Parent { > 开发者谨慎使用bind改变函数调用的上下文,可能会使this指向混乱。 ```ts -@Component -struct Child { - @Builder componentBuilder() { - Text(`Child builder `) - } + @Component + struct Child { + @Builder componentBuilder() { + Text(`Child builder `) + } - label: string = `Child` - @BuilderParam aBuilder0: () => void = this.componentBuilder; - @BuilderParam aBuilder1: () => void = this.componentBuilder; + label: string = `Child` + @BuilderParam aBuilder0: () => void = this.componentBuilder; + @BuilderParam aBuilder1: () => void = this.componentBuilder; - build() { - Column() { - this.aBuilder0() - this.aBuilder1() + build() { + Column() { + this.aBuilder0() + this.aBuilder1() + } } } -} -@Entry -@Component -struct Parent { - label: string = `Parent` + @Entry + @Component + struct Parent { + label: string = `Parent` - @Builder componentBuilder() { - Text(`${this.label}`) - } + @Builder componentBuilder() { + Text(`${this.label}`) + } - build() { - Column() { - this.componentBuilder() - Child({ aBuilder0: this.componentBuilder, aBuilder1: this.componentBuilder }) + build() { + Column() { + this.componentBuilder() + Child({ aBuilder0: this.componentBuilder, aBuilder1: this.componentBuilder }) + } } } -} ``` -- GitLab