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%')
  }
}
  • 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.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
分享
微博
QQ
微信
回复
2024-12-18 19:06:03
相关问题
模态转场来实现框样式页面
1711浏览 • 1回复 待解决
HarmonyOS 模态转场
955浏览 • 1回复 待解决
HarmonyOS Progress 怎样自定义圆角大小
771浏览 • 1回复 待解决
HarmonyOS 关于模态转场疑问
890浏览 • 1回复 待解决
如何固定模态转场高度
1431浏览 • 1回复 待解决
模态转场如何控制固定高度
2740浏览 • 1回复 待解决
如何给自定义框加上圆角背景框
2838浏览 • 1回复 待解决
HarmonyOS 模态转场,如何透传手势?
1224浏览 • 1回复 待解决
自定义弹窗自定义转场动画
1949浏览 • 1回复 待解决
自定义状态获取
1579浏览 • 1回复 待解决
HarmonyOS bindSheet如何自定义圆角
1014浏览 • 1回复 待解决
HarmonyOS 如何自定义导航转场
943浏览 • 1回复 待解决