getAddress() { console.log(‘位置方法’) var that = this; //1、获取当前位置坐标 wx.chooseLocation({ // type: 'wgs84 ', success: function(res) { console.log('wgs84 ') //2、根据坐标获取当前位置名称,显示在顶部:腾讯地图逆地址解析 qqmapsdk.reverseGeocoder({ location: { latitude: res.latitude, longitude: res.longitude }, success: function(addressRes) { console.log(‘获取位置成功’) var address = addressRes.result.ad_info.city; var cityCode = addressRes.result.ad_info.city_code; that.setData({ city: address, cityCode: cityCode, }) wx.setStorage({ key: ‘city’, data: address, success: function(res) { console.log(‘设置位置成功’) } }) wx.setStorage({ key: ‘cityCode’, data: cityCode, success: function(res) { console.log(res) } }) console.log(that.addressNow); } }) }, cancel: function (res) { console.log(‘wgs84cacel’,res); }, fail: function (res) { // wx.openSetting(OBJECT) console.log(‘wgs84fail’,res); } }) },
在onload中加载,没有弹出对话框,直接返回fail:invalid data ,救急!!其他手机都可以,华为mate10中出现问题!救急!!!!