腾讯逆解析坐标封装
common.js
javascript
// common.js
function getCity(latitude, longitude) {
return new Promise((resolve, reject) => {
// key需在腾讯地图申请
wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=xxxxxxxxxxxx&location=` + latitude + ',' + longitude,
success: res => {
resolve(res.data);
}
})
})
},
const common = {
getCity,
};
export default common;