HarmonyOS 半模态转场弹层的圆角没有自定义大小的api

HarmonyOS
2024-12-18 17:09:31
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
aquaa
@Entry
@Component
struct Index {
  @State isShow: boolean = false
  @State isShow2: boolean = false
  @State sheetHeight: number = 300;

  @Builder
  myBuilder() {
    Column() {
      Button("change height")
        .margin(10)
        .fontSize(20)
        .onClick(() => {
          this.sheetHeight = 500;
        })

      Button("Set Illegal height")
        .margin(10)
        .fontSize(20)
        .onClick(() => {
          this.sheetHeight = -1;
        })

      Button("close modal 1")
        .margin(10)
        .fontSize(20)
        .onClick(() => {
          this.isShow = false;
        })
    }
    .width('100%')
    .height('100%')
    //border颜色和backgroundColor一致
    .backgroundColor("#36D")
    //修改圆角大小
    .border({ width: 20, color: "#36D", radius: "200px" })
  }

  build() {
    Column() {
      Button("transition modal 1")
        .onClick(() => {
          this.isShow = true
        })
        .fontSize(20)
        .margin(10)
        .bindSheet($$this.isShow, this.myBuilder(), {
          height: this.sheetHeight,
          //把maskColor和backgroundColor设置一致
          maskColor: Color.Red,
          backgroundColor: Color.Red,
          onAppear: () => {
            console.log("BindSheet onAppear.")
          },
          onDisappear: () => {
            console.log("BindSheet onDisappear.")
          }
        })
    }.justifyContent(FlexAlign.Center).width('100%').height('100%')
  }
}
分享
微博
QQ
微信
回复
2024-12-18 19:06:03
相关问题
模态转场来实现框样式页面
1300浏览 • 1回复 待解决
HarmonyOS 模态转场
578浏览 • 1回复 待解决
HarmonyOS 关于模态转场疑问
496浏览 • 1回复 待解决
HarmonyOS Progress 怎样自定义圆角大小
391浏览 • 1回复 待解决
如何固定模态转场高度
1057浏览 • 1回复 待解决
模态转场如何控制固定高度
2317浏览 • 1回复 待解决
如何给自定义框加上圆角背景框
2416浏览 • 1回复 待解决
自定义弹窗自定义转场动画
1517浏览 • 1回复 待解决
自定义状态获取
1238浏览 • 1回复 待解决
HarmonyOS bindSheet如何自定义圆角
597浏览 • 1回复 待解决
HarmonyOS 如何自定义导航转场
539浏览 • 1回复 待解决