-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【feature】希望Taro提供H5的getLocation功能 #11431
Comments
等待热心的小伙伴解决问题中..., 有一些相关的 issues 可能帮助到你! Thank you so much! |
@ZakaryCode 我也有这个问题,为什么位置相关的方法,在h5中仅支持微信公众号?我们看起来是可以对其进行支持的。 |
@Ghewww 如有时间的话,欢迎pr。 |
事实上h5原生的Geolocation对象就支持获取设备地理位置,相当于要把这个h5对象调用集成到Taro.getLocation的API中 |
如果能提供一个在运行时覆盖Taro自带API的办法,这种问题就没那么多咯 |
@tourze 或许可以说一说你具体的想法。 |
@SyMind 好~感谢提醒 |
例如: import Taro from '@tarojs/taro';
Taro.getLocation = console.error;
Taro.login = () => {
console.warn('H5环境不支持login方法')
}; 现在 @tarojs/taro 导出的对象是不能修改的 |
早期实现,已经不可考 😂 |
其实直接覆盖就行,不过通过 Taro 插件覆盖 H5 提供的 API 目前还不支持,后续可以考虑 |
巧了,我也遇到这个问题,已提交PR |
这个特性解决了什么问题?
通过代码和文档发现目前H5不支持getLocation API,不清楚目前没有支持的原因,希望支持。
代码如下:https://github.com/NervJS/taro/blob/next/packages/taro-h5/src/api/location/index.ts#L15
这个 API 长什么样?
与小程序一样,支持Taro.getLocation({})调用
The text was updated successfully, but these errors were encountered: