HarmonyOS 怎么给bindPopup设置全屏的蒙版

怎么给bindPopup设置全屏的蒙版

HarmonyOS
2024-12-20 17:11:35
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
superinsect

参考如下demo:

@Entry
@Component
struct PopupExample {
  @State handlePopup: boolean = false
  @State customPopup: boolean = false
  // popup构造器定义弹框内容
  @Builder popupBuilder() {
    Row({ space: 2 }) {
      Image($r("app.media.startIcon")).width(24).height(24).margin({ left: -5 })
      Text('Custom Popup').fontSize(10)
    }.width(100).height(50).padding(5)
  }

  build() {
    Flex({ direction: FlexDirection.Column }) {
      // PopupOptions 类型设置弹框内容
      Button('PopupOptions')
        .onClick(() => {
          this.handlePopup = !this.handlePopup
        })
        .bindPopup(this.handlePopup, {
          builder: this.popupBuilder,
          placement: Placement.Top,
          mask: {color: Color.Gray},
          popupColor: Color.Yellow,
          enableArrow: true,
          message: 'This is a popup with PopupOptions',
          placementOnTop: true,
          showInSubWindow:false,
          primaryButton: {
            value: 'confirm',
            action: () => {
              this.handlePopup = !this.handlePopup
              console.info('confirm Button click')
            }
          },
          // 第二个按钮
          secondaryButton: {
            value: 'cancel',
            action: () => {
              this.handlePopup = !this.handlePopup
              console.info('cancel Button click')
            }
          },
          onStateChange: (e) => {
            console.info(JSON.stringify(e.isVisible))
            if (!e.isVisible) {
              this.handlePopup = false
            }
          }
        })
        .position({ x: 100, y: 150 })

    }.width('100%').padding({ top: 5 })
  }
}
分享
微博
QQ
微信
回复
2024-12-20 18:15:11
相关问题
HarmonyOS bindPopup设置color无效
2181浏览 • 1回复 待解决
HarmonyOS bindPopup如何设置箭头颜色
1156浏览 • 1回复 待解决
怎么组件设置下边框?
7992浏览 • 1回复 待解决
TextField怎么某段文字设置颜色
9865浏览 • 2回复 待解决
HarmonyOS bindPopup使用
1177浏览 • 1回复 待解决
HarmonyOS page设置全屏问题
1031浏览 • 1回复 待解决
图片设置replaceholderImage方法
840浏览 • 1回复 待解决
如何设置全屏返回动效
2826浏览 • 1回复 待解决
HarmonyOS Video组件全屏怎么实现
1007浏览 • 1回复 待解决
HarmonyOS 如何image设置遮罩 ?
1403浏览 • 1回复 待解决
HarmonyOS 地图怎么单独全屏显示
1130浏览 • 1回复 待解决