// 1. 申请自己的key
// 2.引入腾讯地图api 文件
// 链接:https://pan.baidu.com/s/1TZvuMqs0cb6L0vGlJiPLCA 提取码:2nug
import QQMapWX from '@/static/utils/qqmap-wx-jssdk'
// 3.当前文件注册
onLoad(option) {
this.qqmapsdk = new QQMapWX({
key: '秘钥' // 在腾讯平台自己申请的秘钥
})
},
data(){
return{
qqmapsdk: null
}
},
methods:{
// 4.获取当前的经纬度
getLocation(){
uni.getLocation({
type: 'wgs84',
success:(res) => {
this.getLocal(res.latitude, res.longitude)
}
})
},
getLocal(latitude,longitude){
qqmapsdk.reverseGeocoder({
location: {
latitude,
longitude
},
success: (res) => {
console.log(res)
},
fail: (err) => {
console.log(err)
},
})
}
}