const getLocationChange = async () => {
console.log('加载定位');
wx.ready(() => {
setTimeout(() => {
wx.getLocation({
type: 'gcj02',
success: async (res) => {
console.log('定位ok');
let resAdd = {
latitude: res.latitude,
longitude: res.longitude
};
localStorage.setItem('coordinate', JSON.stringify(resAdd));
await getStore();
},
fail: function(err) {
console.error('定位失败:', err);
Dialog.alert({
title: '提示',
message: '获取位置信息失败,请刷新',
confirmButtonText: '刷新'
}).then(() => {
location.reload();
});
}
});
}, 1000);
});
};
你好,华为吗?
没测
报错 getLocation:fail:system permission denied是为什么,点击了允许授权,但是不知道为什么获取不到权限,一直走fail