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}`);
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
HarmonyOS
2024-12-24 17:03:38
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
shlp

暂不支持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

分享
微博
QQ
微信
回复
2024-12-24 20:32:46
相关问题
HarmonyOS promptAction.openCustomDialog问题
659浏览 • 1回复 待解决
使用List lazyForeach,reuseId生效
870浏览 • 1回复 待解决
promptAction.openCustomDialog 全局弹窗
1388浏览 • 1回复 待解决
HarmonyOS clearHistory生效
491浏览 • 1回复 待解决
promptAction.openCustomDialog 自定义弹窗
916浏览 • 1回复 待解决
HarmonyOS 文字fontFamily生效
742浏览 • 1回复 待解决