收藏
回答

map组件 bindregionchange 获取中心点真机上无限卡闪

markers 随中心点重新描绘,本地测试版上没问题,ios9.3.3手机拖动,中心 markers无限卡闪

代码:

/*地图视野变化事件*/

  mapChange:function(e){

    var that = this;

    var latitude = that.data.latitude;

    var longitude = that.data.longitude;

    var mapLaclNum = that.data.mapLaclNum;

    if(mapLaclNum>2){

      return;

    }

    mapLaclNum++;

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

        that.mapCtx.getCenterLocation({

        success: function(res){

            console.log(res)

            that.setData({

            longitude: res.longitude

            ,latitude: res.latitude,

            mapLaclNum:mapLaclNum

            // ,markers:[

            //   {

            //   id: 0

            //   ,iconPath: "../../../images/local_c.png"

            //   ,longitude: Number(res.longitude)

            //   ,latitude: Number(res.latitude)

            //   ,width: 30

            //   ,height: 30

            //   }

            // ]

          })

        }

      })

    }else if(e.type == "begin"){

      that.setData({

        mapLaclNum:0,

      })

    }

  },


HTML

<map id="map4select" scale="{{mapScale}}" class="mapStyle" controls="{{controlsImg}}" longitude="{{longitude}}" latitude="{{latitude}}" bindregionchange="mapChange" markers="{{markers}}"></map>

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

12 个回答

  • 张鹏Ⅳ
    张鹏Ⅳ
    2017-10-20

    非常感谢 ,解决咯~~~~~~~

    2017-10-20
    有用
    回复
  • 李晨铭
    李晨铭
    2017-10-20

    嗯 解决了,谢谢,多重复调用更改经纬度所以导致卡顿

    2017-10-20
    有用
    回复

正在加载...

登录 后发表内容