騰訊地圖小程序SDK,success返回的數(shù)據(jù)無法取出
問題描述
騰訊地圖小程序SDK,計算兩個地點的距離,success返回的數(shù)據(jù)無法取出
that.setDate ,前端頁面顯示正常,可是data里面的數(shù)據(jù)沒有修改
app.data.**,通過app()依然無法修改
wx.setStorage ,取出的緩存數(shù)據(jù)一直是上一次緩存的數(shù)據(jù)
希望哪位大神解答下,要怎么取出這個值
問題解答
回答1:qqmapsdk.calculateDistance({
from: {
latitude: that.data.start.location.lat,
longitude: that.data.start.location.lng
},
to: [{
latitude: that.data.end.location.lat,
longitude: that.data.end.location.lng
}],
success: function (res) {
let myDistance = res.result.elements[0].distance
console.log(res.result.elements[0].distance,"00獲取的距離是")
wx.setStorage({
key: 'myDistance',
data: res.result.elements[0].distance,
})
}
