收藏
回答

getLocation偶尔会一直定位中,没有成功回调也没有失败回调,如何处理?

export const getLocationAddress = async () => {

return new Promise((resolve, reject) => {

uni.getLocation({

type: 'gcj02',

isHighAccuracy:true,

highAccuracyExpireTime:5000,

success: (res : any) => {

const curLocation = {

latitude: res.latitude + '',

longitude: res.longitude + ''

}

console.log('获取到定位信息', curLocation)

resolve(curLocation)

},

fail: (err) => {

console.log('获取位置信息失败!')

uni.showToast({ title: '请打开手机定位服务', icon: 'none' })

resolve(null)

}

})

})

}


回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容