uniapp使用腾讯地图获取地址信息

getCity() {
                const QQMapWX = new qqmapsdk({
                    //腾讯地图  需要用户自己去申请key
                    key: "SFABZ-WANWW-FISRY-3IGTF-HV7RE-YSFTI"
                });
                let that = this;

                QQMapWX.reverseGeocoder({
                    location: {
                        latitude: that.myPinInfo.latitude,
                        longitude: that.myPinInfo.longitude
                    },
                    success: function(res) {
                        console.log('解析地址成功', res);
                        that.result = res.result
                        uni.showModal({
                            title: "解析地址",
                            content: "解析地址 = " + JSON.stringify(res)
                        }) 
                        let province = res.result.ad_info.province; // 市
                        let city = res.result.address;
                    },
                    fail: function(res) {
                        console.log(res);
                    },
                    complete: function(res) {
                        console.log(res);
                    }
                });
            },

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-17 21:48:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-17 21:48:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-17 21:48:03       87 阅读
  4. Python语言-面向对象

    2024-03-17 21:48:03       96 阅读

热门阅读

  1. go的fasthttp学习~stackless的writer

    2024-03-17 21:48:03       38 阅读
  2. MySQL 索引

    2024-03-17 21:48:03       39 阅读
  3. Qt——智能指针实战

    2024-03-17 21:48:03       45 阅读
  4. spring MVC 自定义注解实现路径匹配

    2024-03-17 21:48:03       42 阅读
  5. qt之画图

    2024-03-17 21:48:03       34 阅读
  6. Spring中的bean相关问题

    2024-03-17 21:48:03       48 阅读
  7. Ts中WebSocket连接管理与维护教程

    2024-03-17 21:48:03       30 阅读