获取目前所处位置
onShow(){
var that=this;
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude1 = res.latitude;
const longitude1 = res.longitude;
const speed1 = res.speed;
const accuracy1 = res.accuracy;
that.setData({
longitude: res.longitude,
latitude: res.latitude
})
}
})
},
onShow(){
this.getLocation(this);
},
getLocation()
{
wx.getLocation({
type: 'wgs84',
success: this.handleGetLocationSucc.bind(this)
})
},
handleGetLocationSucc(res)
{
this.setData({
longitude: res.longitude,
latitude: res.latitude
})
},