HarmonyOS 气泡点击蒙层问题

在实现自定义气泡时,设置autoCancel的值为true,点击其他地方会导致气泡消失,符合预期,但气泡的状态还是true。

以下是MVP版本:

@State customPopup: boolean = false 
testOption2: CustomPopupOptions = { 
  builder: this.popupBuilder.bind(this), 
  autoCancel: true, 
} 
Button('CustomPopupOptions') 
  .onClick(() => { 
    this.customPopup = !this.customPopup 
  }) 
  .bindPopup(this.customPopup, this.testOption2) 
  .position({ x: 80, y: 200 }) 
}.width('100%').padding({ top: 5 })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.

当点击空白地方消失气泡,此时this.customPopup任然为true,需要在按钮上点击两下,再次弹出气泡,期望是点击一下

HarmonyOS
2024-08-09 10:56:03
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

可以在CustomPopupOptions中添加状态改变的函数,进而关联气泡的展示状态,代码如下: onStateChange: (e) => { this.customPopup= e.isVisible }

分享
微博
QQ
微信
回复
2024-08-09 17:29:05
相关问题
HarmonyOS bindsheet去除
675浏览 • 1回复 待解决
HarmonyOS 或护眼模式方案咨询
783浏览 • 1回复 待解决
HarmonyOS 气泡背景颜色问题
517浏览 • 1回复 待解决
如何去除Tabs组件两侧的
2506浏览 • 1回复 待解决
Web组件下网页中图片长按出现
1440浏览 • 1回复 待解决
HarmonyOS Popup气泡支持边框问题
575浏览 • 1回复 待解决
HarmonyOS bindPopup自定义气泡问题
518浏览 • 1回复 待解决
HarmonyOS点击事件透传处理
902浏览 • 1回复 待解决