微信小程序使用腾讯地图插件
-
腾讯地图官网申请key
-
在app.json 加入以下代码
"permission": { "scope.userLocation": { "desc": "你的位置信息将用于小程序位置接口的效果展示" } }, "plugins": { "chooseLocation": { "version": "1.0.5", "provider": "wx76a9a06e5b4e693e" } },
-
引入
const chooseLocation = requirePlugin('chooseLocation');
-
跳转详情代码
showLocation() { const key = 'MUUBZ-7WUWS-GLOOH-63FP5-OGMU5-BYB6P'; //使用在腾讯位置服务申请的key const referer = '1'; //调用插件的app的名称 const location = JSON.stringify({ latitude: this.data.latitude, //通过小程序位置接口获取的经纬度 longitude: this.data.longitude }); const category = ''; wx.navigateTo({ url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category }); },