收藏
回答

鸿蒙系统下的map组件的marker多出来一个气泡

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug map 鸿蒙客户端 8.0.51 3.9.0

因为是用户的手机出现的,现象是地图的map上多了一个气泡,气泡上显示1(如图

其他手机上未出现这种显现,我们开发测试自己的手机未能复现。

用户手机是鸿蒙4.0.0.121, 微信8.0.51, 基础库版本:未知(上面填的不对,因为是必填的所以写了最新的,用户的手机没办法开console去看)

下面是代码片段,代码中没有设置要显示这个1,两个marker都是图标

const markers = [
        { 
          id: 1,
          latitude: parseFloat(latitude),
          longitude: parseFloat(longitude),
          iconPath: 'https://cdn-pub.leap.ling.space/weapp/static/location/icon-location-2.png',
          width: 32,
          height: 44,
          anchor: {
            x: 0.5,
            y: 0
          }
        }
      ]
      if (this.child.figure_avatar) {
        markers.push({
          id: 2,
          latitude: parseFloat(latitude),
          longitude: parseFloat(longitude),
          iconPath: this.child.figure_avatar,
          width: 90,
          height: 120,
          anchor: {
            x: 0.5,
            y: 1
          }
        })
      }
      
      if (this.markers && this.markers.length === markers.length) {
        for (let i=0; i<markers.length; i++) {
          let marker = markers[i]
          this.markers[i].latitude = marker.latitude
          this.markers[i].longitude = marker.longitude
          this.map.translateMarker({
            markerId: marker.id,
            latitude: marker.latitude,
            longitude: marker.longitude,
            success: () => {
              console.log('[location]地图中心点移动成功')
            },


            fail: (error) => {
              console.error('[location]地图中心点移动失败', error)
            }
          })
        }
      } else {
        this.markers = markers
      }
回答关注问题邀请回答
收藏

2 个回答

  • 智能回答 智能回答 本次回答由AI生成
    2025-08-07
    有用
  • 传瑜
    传瑜
    2025-08-07

    各路大神,有知道的帮忙解答,多谢!

    2025-08-07
    有用
    回复
登录 后发表内容