map组件中 bindregionchange 无限触发
发布于 6 年前 作者 xiuyingwu 1682 次浏览 来自 问答

wxml:

<map latitude="{{latitude}}" longitude="{{longitude}}"  scale="{{buildlData[isSelectedBuildType].scale+2}}" bindcontroltap="controltap" markers="{{buildlData[isSelectedBuildType].data}}" bindmarkertap="markertap" bindregionchange="regionchange" include-points="{{buildlData[isSelectedBuildType].data}}"    show-location="{{islocation? 'true': 'false'}}" controls="{{controls}}" style="width: auto; height:{{fullscreen ? 89 : 48}}vh;background-color: #fff;">
  </map><!-- 地图 -->

js:

regionchange(e) {
    //console.log(e.type)
    //if (!this.data.fullscreen) {
      if(e.type == "end"){
        this.setData({ fullscreen: !this.data.fullscreen })
        if (this.data.fullscreen) {
          this.setControls(this.data.windowWidth, this.data.windowHeight - 54)
          this.setData({
            clickchar: "⇑"
          })
        } else {
          this.setControls(this.data.windowWidth, this.data.windowHeight / 2)
          this.setData({
            clickchar: "⇓"
          })
        }
        //移动地图事件
    // }*/
      }

代码的大意是移动地图就改变是否全屏的状态

在电脑上测试没有问题

但是到手机上就循环触发事件

代码没有改变经纬度的值

不知道为什么

3 回复

您好,可以尝试更新下微信到6.6.7版本,这个版本中使用矢量地图,看看是否还存在这个问题。

同问 求解决办法

同问,请问有没有解决

回到顶部