HarmonyOS 控件点击事件无响应

使用Popup 做引导 点击这个气泡指向的(bind)的那个控件(的位置),气泡消失,但是那个控件的点击事件没有被响应到,这个气泡的引导效果就会被弱化,这个有办法解决么

HarmonyOS
2025-01-09 15:32:14
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple

示例参考如下:

import { router } from '@kit.ArkUI'

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

  aboutToAppear(): void {
    setTimeout(()=>{
      this.customPopup = !this.customPopup
    }, 3000)
  }
  build() {
    Column() {
      Button('CustomPopupOptions')
        .position({x:100,y:200})
        .onClick(() => {
          router.pushUrl({
            url:"pages/Page1"
          })
        })
        .bindPopup(this.customPopup, {
          builder: this.popupBuilder, // 气泡的内容
          placement:Placement.Bottom, // 气泡的弹出位置
          popupColor:Color.Pink, // 气泡的背景色
          mask: false,
          onStateChange: (e) => {
            console.info(JSON.stringify(e.isVisible))
            if (!e.isVisible) {
              this.customPopup = false
            }
          }
        })
    }
    .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.
分享
微博
QQ
微信
回复
2025-01-09 17:27:01
相关问题
HarmonyOS点击事件传递响应问题
528浏览 • 1回复 待解决
HarmonyOS push可以收到,但点击反应
516浏览 • 1回复 待解决
HarmonyOS web下载文件点击反应
849浏览 • 1回复 待解决
HarmonyOS 点击事件过滤
509浏览 • 1回复 待解决
HarmonyOS如何增加控件点击热区?
1050浏览 • 1回复 待解决
HarmonyOS ReactNavigation点击事件穿透
480浏览 • 1回复 待解决
HarmonyOS 卡片点击事件失效
645浏览 • 1回复 待解决
HarmonyOS 富文本点击事件
1328浏览 • 1回复 待解决
HarmonyOS 点击事件监听问题
650浏览 • 1回复 待解决