自定义的弹窗,怎么在封装的类中调用。比如下面的写法,这个方法show是有问题的。
@CustomDialog
struct CustomDialogExample {
controller?: CustomDialogController
build() {
Column() {
Text('我是内容').fontSize(16).margin({ bottom: 10 })
}
}
}
@Builder
export function builderPageFunc(): void {
CustomDialogExample();
}
export class Hud{
static show(){
let option : CustomDialogControllerOptions = {
builder:builderPageFunc()
}
let dialogController: CustomDialogController = new CustomDialogController(option);
dialogController.open()
}
}
目前CustomDialog不支持在class中封装,因为弹窗需要根据上下文来弹出。