使用PromptAction调用openCustomDialog时maskColor未生效,代码如下:
class Params {
text: string = ""
constructor(text: string) {
this.text = text;
}
}
@Builder
function buildText(params: Params) {
Column() {
Text(params.text)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({bottom: 36})
}.backgroundColor(Color.Red)
.width(300)
.height(300)
}
let promptAction = uiContext.getPromptAction();
let contentNode = new ComponentContent(uiContext, wrapBuilder(buildText), new Params('dddddd'));
try {
console.log('OpenCustomDialog start....');
promptAction.openCustomDialog(contentNode,
{
alignment: DialogAlignment.Center,
autoCancel: false,
maskColor: '00000000',
showInSubWindow: true,
isModal: true,
}
)
} catch (error) {
let message = (error as BusinessError).message;
let code = (error as BusinessError).code;
console.error(`OpenCustomDialog args error code is ${code}, message is ${message}`);
}
暂不支持isModal = true与showInSubWindow = true同时使用。showInSubWindow 置为false即可展示蒙层。
参考文档:https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/js-apis-promptAction.md\#promptactionopencustomdialog11