1、js文件
const coordtransform = require('../../utils/location-change.js')
data: {
address: ''
},
getLocation() {
console.log('位置弹框跳起...')
const that = this
// 获取位置信息弹窗
wx.getLocation({
type: 'wgs84',
altitude: 'true',
isHighAccuracy: true,
success(res) {
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + ',' + res.longitude + '&key=QMEBZ-DD2LV-XEZPT-UUB7G-SJCS7-EVBZD'
// 高德地图 逆向编码,根据经纬度获取详细地址信息 高德域名
wx.request({
url: 'https://restapi.amap.com/v3/geocode/regeo',
data: {
key: '0c7747a5ebd6d2fb7c3aa53e8ec3256b', // 高德地图应用中的key
location: coordtransform.bd09togcj02(res.longitude, res.latitude)[0] + "," + coordtransform.bd09togcj02(res.longitude, res.latitude)[1], // 经度在前,纬度在后,一定不要写错了
ex