wx.getLocation失败
wx.getLocation({
type: ‘gcj02’,
// type: ‘wgs84’,
success: (res) => {
var latitude = res.latitude
var longitude = res.longitude
var speed = res.speed
var accuracy = res.accuracy
this.setData({ latitude: latitude, longitude: longitude })
wx.showModal({
title: ‘当前位置’,
content: ‘经度’ + longitude + ‘纬度’ + latitude,
})
},
cancel: function (res) {
console.log(res);
},
fail: function (res) {
console.log(res);
wx.authorize({scope: “scope.userLocation”});
wx.showModal({
title: ‘当前位置2’,
content: ‘经度2’
})
}