arkUI自定义组件,父组件如何获取子组件对象,调用其方法

@Entry
@Component
struct Index {
  @State message: string = 'Hello World'
  customComponent: CustomComponent = CustomComponent()
  build() {
    Row() {
      Column() {
        Text(this.message)
          .fontSize(50)
          .fontWeight(FontWeight.Bold)
          .onClick(() => {
            this.d.caretPosition(3)
            hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
            hilog.info(0x0000, 'testTag', 'Test NAPI 2 + 3 = %{public}d', testNapi.add(2, 3));
          })
          this.customComponent
      }
      .width('100%')
    }
    .height('100%')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
UI
组件
鸿蒙
2023-02-22 15:45:19
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
babblue
分享
微博
QQ
微信
回复
2023-02-22 17:47:17
相关问题
组件调用组件方法
2213浏览 • 1回复 待解决
HarmonyOS 组件调用组件方法
861浏览 • 1回复 待解决
组件调用组件里的方法
1100浏览 • 1回复 待解决
HarmonyOS 组件怎么调用组件方法
1191浏览 • 1回复 待解决
HarmonyOS 组件调用组件方法demo
843浏览 • 1回复 待解决