function _getLocation() {
return new Promise(async (resolve, reject) => {
try {
uni.getLocation({
type: 'wgs84',
success: (e) => {
console.log(e);
const { latitude, longitude } = e;
resolve({
latitude: latitude || '',
longitude: longitude || '',
});
},
fail: (err) => {
console.log(err);
resolve({
latitude: '',
longitude: '',
});
},
});
} catch (err) {
resolve({
latitude: '',
longitude: '',
});
}
});
}
0 个回复