问题描述
我从用户那里获取地理位置,我想显示一个进度条而不是一个加载器。如何获取进度?
这是当前代码:
const fetchGeoLocation = async (
resolve,status
) => {
const geo = navigator.geolocation;
if (!geo) return status({ loading: false,error: "geolocation.error.unavailable" });
const error = (err: any) => {
if (err.code === 1)
return status({
loading: false,error: "geolocation.error.permission_denied",});
if (err.code === 2)
return status({ loading: false,error: "geolocation.error.unavailable" });
if (err.code === 3)
return status({ loading: false,error: "geolocation.error.timeout" });
};
const success = (position) => {
resolve(position);
status({ loading: false,error: "" });
};
geo.getCurrentPosition(success,error,{ maximumAge: 10000 });
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)