首次安装后位置授权成功,但是列表空白,然后清了一下后台再次打开就正常了
3***@qq.com
- 发布:2023-11-13 17:55
- 更新:2023-11-14 08:44
- 阅读:299
3***@qq.com (作者)
我是这样掉的
uni.chooseLocation({
latitude:this.info.Latitude,
longitude:this.info.Longitude,
success: (res) =>{
console.log(res,'res')
// this.info.Latitude =res.latitude
// this.info.Longitude =res.longitude
this.info.Latitude = res.latitude+'';
this.info.Longitude = res.longitude+'';
// this.$set(this.info,'Latitude',res.latitude)
// this.$set(this.info,'Longitude',res.longitude)
this.$nextTick(()=>{
2023-11-14 09:00
3***@qq.com (作者)
这是整个方法
handleChoose(){
console.log('获取定位')
const res = uni.getAppAuthorizeSetting();
console.log(JSON.stringify(res),'res')
console.log(res.locationAuthorized)
if(res.locationAuthorized=='denied'||res.locationAuthorized=='not determined'||res.locationAuthorized=='config error'){
uni.showModal({
title:'提示',
content:'无法获取位置,请手动授权。',
success:res=>{
if(res.confirm){
uni.openAppAuthorizeSetting()
}
}
})
}else if(res.locationAuthorized=='authorized'){
uni.chooseLocation({
latitude:this.info.Latitude,
longitude:this.info.Longitude,
success: (res) =>{
console.log(res,'res')
// this.info.Latitude =res.latitude
// this.info.Longitude =res.longitude
this.info.Latitude = res.latitude+'';
this.info.Longitude = res.longitude+'';
// this.$set(this.info,'Latitude',res.latitude)
// this.$set(this.info,'Longitude',res.longitude)
this.$nextTick(()=>{
2023-11-14 09:01