wx.getLocation 定位点不在地图中心
发布于 6 年前 作者 wchen 17720 次浏览 来自 问答

代码如下:


onLoad: function () {

    let self = this;

    //初始化位置

    wx.getLocation({

      //type: ‘gcj02’,

      success: function(res) {

        self.setData({

          latitude: res.latitude,

          longitude: res.longitude

        });

      },

})

<map id=“map” show-location  latitude=’{{latitude}}’ longitude=’{{longitude}}’>

在开发工具上显示的位置是在地图中心,但是真机上不在地图中心,如下:

show-location的位置不在地图中心,求各位大牛指点~

3 回复

需要gcj02坐标,不要注释此行 。

//type: ‘gcj02’,

楼主解决没有,遇到同样的问题

调用一下moveToLocation

回到顶部