在HarmonyOS NEXT开发中@Builder 按引用传递参数编译错误?

在HarmonyOS NEXT开发中@Builder 按引用传递参数编译错误?编译提示:Object literals cannot be used as type declarations (ArkTS-no-obj-literals-as-types) <ArkTSCheck>
代码:

@Builder overBuilder($$: { paramA1: string }) { 
  Row() { 
    Text(`UseStateVarByReference: ${$$.paramA1} `) 
  }
阅读 511
1 个回答

具体参考代码:

class Tmp{ 
  paramA1:string = ‘’ 
} 
@Builder function overBuilder($$ : Tmp) { 
  Text($$.params) 
    .width(400) 
    .height(50) 
    .backgroundColor(Color.Blue) 
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题