收藏
回答

map组件根据bindregionchange动态添加markers,安卓不可以

在地图上我想根据地图的缩放来动态改变markers显示的多少,我根据地图的缩放等级来进行判断,然后setData


但是在苹果手机上实现了

安卓手机(华为)却不行  地图放大可以增加markers但缩小的时候却不会减少markers


回答关注问题邀请回答
收藏

2 个回答

  • 禾店短剧系统
    禾店短剧系统
    2021-06-06

    bindregionchange确实是会触发两次,第一次是视野变化开始,第二次是视野变化结束。

     

    你可以尝试把e.type给打印出来,值为begin表示开始,值为end表示结束。

    2021-06-06
    有用 1
    回复
  • 是小白啊
    是小白啊
    2018-11-29

    提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2018-11-29
    有用
    回复 2
    • G.ed
      G.ed
      2018-11-29

      小米6  微信最新版本    华为TRT-AL00A   微信最新版本

      regionchange: function (e) {

      if (e.type == "end") {

      var that = this;

      this.mapCtx.getScale({

      success: function (e) {

      console.log("缩放级别", e.scale)

      var lists = that.data.markers.slice(0, 3);

      if (e.scale > 13) {


      } else if (e.scale > 7){


      } else {


      }

      console.log(lists)  //打印的值已经减少来了  但是页面上体现不出来

      that.setData({

      markers: lists

      })

      }

      })


      }

      },


      2018-11-29
      回复
    • 是小白啊
      是小白啊
      2018-11-29回复G.ed

      https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html按照教程提供下

      2018-11-29
      回复
登录 后发表内容