HarmonyOS 自定义弹窗不能和V2版本的状态管理一起用吗?

我想创建一个自定义弹窗,并使用V2版本的状态管理给这个弹窗传一些参数,但是编译器提示我:

The struct 'CustomDialogExample' can not be decorated with '@ComponentV2' and '@Component', '@Reusable', '@CustomDialog' at the same time. <ArkTSCheck\>

下面是我的代码:

@ComponentV2
@CustomDialog
export struct CustomDialogExample {
  @Param @Require title: string = ""
  controller: CustomDialogController = new CustomDialogController({
    builder: CustomDialogExample({ title: "所在区域" }),
  })

  build() {
    Column() {
      Text(this.title).fontSize(30)
    }.backgroundColor("#FFF")
  }
}
阅读 480
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进