[微信小程序]获取当前位置坐标问题 [对于问题,给我一个另类的答案吧!]

- 当前 Bug 的表现(可附上截图)

我调用api中的wx.getLocation获取我当前位置的坐标,然后再打开地图,发现获取到的坐标不是我当前位置的坐标,获取到的数据如下:

latitude=39.90469;longitude=116.40717;speed=-1;accuracy=65;显示如上图所示。

但是我不在北京,我在天津啊,下面的大图是我当前位置,这是个什么情况啊?


附上代码

getBiddingList: function () {
    var that = this;
    wx.getLocation({
      type:'wgs84',
      success: function(res) {
        const latitude = res.latitude
        const longitude = res.longitude
        const speed = res.speed
        const accuracy = res.accuracy
        console.log('latitude=' + latitude + ';longitude=' + longitude + ';speed=' + speed + ';accuracy=' + accuracy)
        wx.openLocation({
          latitude,
          longitude,
          scale: 18
        })
      },

    })

}

- 预期表现


- 复现路径


- 提供一个最简复现 Demo


  • 你好,你的代码我执行了是可以获取的, 你看一下原因: 1. 是否在app.json填写如下 2. 看 一下自己手机是否打开定位设置, 看吧,让你看到想吐为止。
    • 这个肯定是写的,不写的话连地图都显示不出来的,可能是微信做的地图定位本身就不太准确,最好还是用百度或腾讯地图提供的api接口获取到的地理坐标比较准确一点。, 想用百度的话,首先你要有网。