- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
//获取具体的位置信息
getSpecificLocation: function (latitude, longitude) {
var that = this;
var apiURL = “https://apis.map.qq.com/ws/geocoder/v1/?output=json&location=” + latitude + “,” + longitude + “&key=***”;
wx.request({//根据经纬度获取具体位置信息
url: apiURL,
success: function (res) {
console.log(res);
var location = {};
location = that.data.location;
location.address = res.data.result.address;
location.addressName = res.data.result.formatted_addresses.recommend;//报错Cannot read property ‘recommend’ of undefined;at api request success callback function
that.setData({
location: location,
})
}
})
},