HarmonyOS 弹窗最外层有一圈背景色,无法去除?

如题:HarmonyOS 弹窗最外层有一圈背景色,无法去除?

阅读 460
1 个回答

需要添加配置:backgroundBlurStyle:BlurStyle.NONE,修改之后的代码如下:

@Entry
@Component
struct Index {
  dialogController: CustomDialogController = null!!

  build() {
    Row() {
      Text('打开dialog')
        .fontSize(30)
        .onClick(() => {
          this.dialogController = new CustomDialogController({
            builder: PaperEditionDialog({
              onSelect: (index: number) => {
              }
            }),
            cancel: () => {
          },
            backgroundBlurStyle:BlurStyle.NONE,
          autoCancel: true,
          alignment: DialogAlignment.Bottom,
          offset: { dx: 0, dy: 0 },
          showInSubWindow: false,
          isModal: true,
          customStyle: false,
          width: '88%',
          backgroundColor: Color.Transparent
        })
      this.dialogController.open()
    })
  }

}
}
@CustomDialog
export struct PaperEditionDialog {
  @Prop currentSelectIndex: number = 0
  @Prop editionArray: Array<string>
  controller?: CustomDialogController
  onSelect?: (index: number) => void
  build() {
    Column() {
      Column() {
        Grid() {
        }
        .rowsGap(20)
        .columnsGap(20)
        .columnsTemplate('1fr 1fr 1fr 1fr 1fr')
        .scrollBar(BarState.Off)
        .width('100%')
        .height(200)
      }
      .padding(20)
      .backgroundColor(Color.Green)
      .borderRadius(6)

      Image($r('app.media.small_down_icon'))
        .fillColor(Color.Green)
        .width(28)
        .margin({ left: 80, top: -2 })
    }
    .width('100%')
    .backgroundColor(Color.Transparent)

  }
}