Files
xdd-uniapp-new/utils/common.js
T
2023-09-20 21:49:33 +08:00

24 lines
582 B
JavaScript

import config from '@/utils/mapConfig';
module.exports = {
getLocation() {
return uni.getLocation({
type: 'wgs84'
})
},
getCurAddress(latitude, longitude) {
return uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
'&key=' + config.key
});
},
getUrlParam(url, name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = url.match(reg);
if (r != null) return (r[2]);
return null;
}
}