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

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

阅读 497
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%')
  }
}