原创声明:本文为作者原创,未经允许不得转载,经授权转载需注明作者和出处

如图
1.能获取经纬度(latitude、longitude),但是不能获取位置名称(name)和详细地址(address);
2.通过获取的位置信息无法在官方IDE中准确定位,只有在手机预览中才能正常定位。
不知道是不是bug。
代码如下:
//获取位置信息 
getLocation: function (e) {
    console.log(e)
    var that = this
    wx.getLocation({
      success: function (res) {
        console.log(res)
        that.setData({
          hasLocation: true,
          location: {
            longitude: res.longitude,
            latitude: res.latitude,
            name: res.name,
            address: res.address,
            accuracy:res.accuracy,
          }
        })
      }
    })
  },
//打开地图定位  
openLocation: function (e) {
    var value = e.detail.value
    wx.openLocation({
      longitude: Number(value.longitude),
      latitude: Number(value.latitude),
    })
  }
新手问题,见谅~(其实我就是为了积分哈哈哈哈)