3***@qq.com
3***@qq.com
  • 发布:2023-11-13 17:55
  • 更新:2023-11-14 08:44
  • 阅读:299

uniapp打包后使用chooseLocation选择位置,位置列表空白 小米12x,位置权限已允许. 真机调试无问题,打包安装后空白

分类:uni-app

首次安装后位置授权成功,但是列表空白,然后清了一下后台再次打开就正常了

2023-11-13 17:55 负责人:无 分享
已邀请:
套马杆的套子

套马杆的套子 - 没有解决不了的问题,只有解决不完的问题

app?我刚测试了没问题,
你是怎么调用的?

  • 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(()=>{


                            // this.$forceUpdate()  
    this.$refs.uForm.validateField('Latitude',(err)=>{console.log(err,'err')})
    this.$refs.uForm.validateField('Longitude')
    })

    },
    complete:e=>{
    console.log(JSON.stringify(e))
    },
    fail:e=>{
    console.log(JSON.stringify(e))
    }
    });

    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(()=>{


                            // this.$forceUpdate()  
    this.$refs.uForm.validateField('Latitude',(err)=>{console.log(err,'err')})
    this.$refs.uForm.validateField('Longitude')
    })

    },
    complete:e=>{
    console.log(JSON.stringify(e))
    },
    fail:e=>{
    console.log(JSON.stringify(e))
    }
    });
    }

    },

    2023-11-14 09:01

该问题目前已经被锁定, 无法添加新回复