3***@qq.com
3***@qq.com
  • 发布:2021-09-22 19:14
  • 更新:2021-09-22 19:14
  • 阅读:595

uni作app如何得到当前经纬度(使用uni.getlocation一直失败,app需要先获取权限吗?)

分类:uni-app
//获取地理位置  
            getLocation() {  
                uni.getLocation({  
                    type: 'gcj02',  
                    success:  (res)=> {  
                        this.formData.latitude = res.latitude  
                        this.formData.longitude = res.longitude  
                        console.log(res)  
                    },  
                    fail: ()=> {  
                        uni.showToast({  
                            title: '获取地址失败,将导致部分功能不可用',  
                            icon: 'none'  
                        });  
                    }  
                });  
            },
2021-09-22 19:14 负责人:无 分享
已邀请:

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