diff --git a/zh-cn/application-dev/quick-start/arkts-builderparam.md b/zh-cn/application-dev/quick-start/arkts-builderparam.md index 8151b6e8eb4ed82a4103206871025f18dd6e6488..9e1ca6bc87cce2b06c5cddb8c7f78d9cae79997e 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 }) + } } } -} ```