我想创建一个自定义弹窗,并使用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")
}
}
@ComponentV2状态管理还在完善开发中,自定义弹窗我们推荐使用openCustomDialog,具体参考:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-promptaction-V5\#promptactionopencustomdialog11