HarmonyOS PromptAction调用openCustomDialog时maskColor未生效?

使用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}`);
}
阅读 575
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进