代码如下:
const [err, loc] = await uni.getLocation({
type: 'gcj02'
});
if (err) {
console.log(err)
}
返回err,打印如下:
“{ "errMsg": "getLocation:fail Cannot read properties of undefined (reading 'then')" }”
初学者,请教大神指点,多谢!
1 个回复
爱豆豆 - 办法总比困难多
getLocation不是Promise对象
可以用成功回调获取到返回数据
参考文档:https://uniapp.dcloud.net.cn/api/location/location.html