欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 艺术 > 微信小程序 uniapp 腾讯地图的调用

微信小程序 uniapp 腾讯地图的调用

2025/4/3 5:29:54 来源:https://blog.csdn.net/weixin_46256404/article/details/143329892  浏览:    关键词:微信小程序 uniapp 腾讯地图的调用

/*
                提前在您的app.json上加上这些代码
                "permission": {
                    "scope.userLocation": {
                      "desc": "你的位置信息将用于地图中定位"
                    }
                  }
                */
                wx.request({
                    url: 'https://apis.map.qq.com/ws/geocoder/v1/?key='+this.key+'&address='+address,
                    success: res => {
                        console.log(res) // 此处返回的就是城市名称
                        this.longitude= res.data.result.location.lng;
                        this.latitude = res.data.result.location.lat;
                    }
                })

<div class="row">
                    <div style="width: 100%;margin: 0 auto;overflow: hidden;margin-left: 8%;">
                        <map :latitude="latitude" :longitude="longitude" :markers="covers"
                            style="margin-left: -16%;"></map>
                    </div>
                </div>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词