getLocationFun() {
wx.showLoading({
title: '加载中...',
mask: true,
})
let that = this;
// return new Promise((resolve, reject) => {
let _locationChangeFn = (res) => {
console.log('location change', res)
wx.hideLoading()
that.lon = res.longitude;
that.lat = res.latitude;
that.searchClick(); // 刷新列表
wx.offLocationChange(_locationChangeFn)
}
wx.startLocationUpdate({
success: (res) => {
console.log(res);
wx.onLocationChange(_locationChangeFn)
// resolve()
},
fail: (err) => {
console.log('获取当前位置失败', err)
wx.hideLoading()
// reject()
}
})
// })
},
这是监听经纬度代码,获取到经纬度后刷新列表,列表接口本身是很快的,请问有什么优化方案