map点的聚合显示问题?
发布于 4 年前 作者 fangqian 7593 次浏览 来自 问答
markers: [
      {
        clusterId6,
        height"32rpx",
        iconPath"https://stpg.01mmc.cn/prod-api/file/statics/icon/logo/weather_logo_5.png",
        id6,
        joinCluster: true,
        latitude30.183178077712377,
        longitude120.1595385032642,
        name"心心农场气象站2",
        width"32rpx",
      },
      {
        clusterId1664113273962283000,
        height"32rpx",
        iconPath"https://stpg.01mmc.cn/prod-api/file/statics/icon/logo/sensor_logo_5.png",
        id1664113273962283000,
        joinCluster: true,
        latitude30.18135020060892,
        longitude120.15633463926073,
        name"心心农场传感器2",
        width"32rpx",
      },
      {
        clusterId5,
        height"32rpx",
        iconPath"https://stpg.01mmc.cn/prod-api/file/statics/icon/logo/valvesin0_logo_5.png",
        id5,
        joinCluster: true,
        latitude30.183262180971205,
        longitude120.1567566743741,
        name"心心农场控制器2",
        width"32rpx",
      }
    ]

这三个点在模拟器上都显示,在真机上就只显示一个

去掉聚合的相关代码(去掉点上的joinCluster和clusterId属性以及addMarkers方法),真机上三个点就都显示了为什么呀?求大神帮忙

代码片段https://developers.weixin.qq.com/s/OZZaFDmD7hII

1 回复

配置的marker有问题,一开始是不需要设置clusterId的,形成聚合之后才有的clusterId,另外他的宽高也设置错了,多rpx,去掉clusterId,宽高设置为数字,即可

回到顶部