我有以下功能:
func = async () => {
let location = await getLocation();
console.log(location)
}
它调用这个函数
getLocation = async () => {
Geolocation.getCurrentPosition(
(position) => {
return 1
}
);
};
当我调试时,我发现代码确实到达了该return 1行,但func它总是设置location为undefined. 我在这里的异步调用做错了吗?