HarmonyOS 半模态圆角弹窗无法修改,自定义标题无法撑满全屏

HarmonyOS
2024-12-24 18:12:15
1.2w浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

可以参考以下demo

@Entry
@Component
struct bindsheet {
  @State isShow: boolean = false
  @State sheetHeight: number = 300;
  @State showDragBar: boolean = true;

  @Builder
  myBuilder() {
    Column() {
      Button('关闭关闭按钮')
        .margin(10)
        .fontSize(20)
        .onClick(() => {
          this.showDragBar = false;
        })
      Button('打开关闭按钮')
        .margin(10)
        .fontSize(20)
        .onClick(() => {
          this.showDragBar = true;
        })
    }
    .width('100%')
    .height('100%')
  }

  build() {
    Column() {
      Button('打开弹窗')
        .onClick(() => {
          this.isShow = true
        })
        .fontSize(20)
        .margin(10)
        .bindSheet($$this.isShow, this.myBuilder(), {
          detents: [SheetSize.MEDIUM, SheetSize.LARGE, 200],
          backgroundColor: Color.Gray,
          blurStyle: BlurStyle.Thick,
          showClose: this.showDragBar,
          // showClose属性为true时显示关闭按钮,不想通过关闭按钮来关闭bindsheet弹窗的话,可以将showClose属性变为false
          enableOutsideInteractive: false,
          preferType: SheetType.CENTER,
          shouldDismiss: ((sheetDismiss: SheetDismiss) => {
            console.log('bind sheet shouldDismiss')
            sheetDismiss.dismiss()
          })
        })
    }
    .justifyContent(FlexAlign.Start)
    .backgroundColor('#ff578ddd')
    .width('100%')
    .height('100%')
  }
}
  • 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.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
分享
微博
QQ
微信
回复
2024-12-24 20:41:38


相关问题
HarmonyOS 全局自定义弹窗无法弹出
568浏览 • 1回复 待解决
HarmonyOS 自定义弹窗遮罩未全屏
1276浏览 • 1回复 待解决
HarmonyOS bindSheet模态弹窗
1111浏览 • 1回复 待解决
基于bindSheet的模态弹窗
1685浏览 • 1回复 待解决
HarmonyOS 自定义全屏dialog
568浏览 • 1回复 待解决
HarmonyOS Slider无法自定义滑轨样式
605浏览 • 1回复 待解决
HarmonyOS bindSheet如何自定义圆角
713浏览 • 1回复 待解决
自定义弹窗自定义转场动画
1629浏览 • 1回复 待解决