HarmonyOS bindPopup怎么获取弹出的message的点击事件?

bindPopup怎么获取弹出的message的点击事件,不想自定义,primaryButton文字颜色不能设置,而且不好看,没有系统的弹出好看,所以想加一个点击事件。

阅读 496
1 个回答

参考示例demo如下:

@Entry
@Component
struct Index {
  @State showPop:boolean = false
  @Builder
  popBuilder(){
    Column(){
      Text('弹出气泡').fontColor(Color.White)
    }.height(50)
  }
  build() {
    Row() {
      Text('点我弹气泡').onClick(()=>{
        this.showPop = !this.showPop
      }).bindPopup(this.showPop, {
        builder:this.popBuilder(),
        placement:Placement.Top,
        popupColor:'#FF0000',
        backgroundBlurStyle:BlurStyle.NONE,
        mask:false,
        radius:5,
        offset:{x:0, y:5},
        onStateChange:(v)=>{
          if(!v.isVisible){
            this.showPop = false
          }
        }
      })
    }
    .height('100%')
    .width('100%')
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进