arcgis使用mapView.openPopup点击后弹出气泡只展示一次bug解决

发布时间 2023-09-01 15:05:39作者: ZerlinM

问题

点击后弹出气泡的功能,但是只在第一次点击时正常展示气泡,之后点击无反应,代码如下

mapView.on('click', (e: any) => {
  mapView.hitTest(e).then((e2: any) => {
    e2.results.forEach((e3: any) => {
      let attrs = e3.graphic.attributes
      mapView.openPopup({
        title: 'A',
        content: 'AA',
        location: attrs.poi
      })
    })
  })
})

解决

在添加点击事件之前添加

mapView.popup.autoOpenEnabled = false