-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
定位控件中address为“null”时不抛出错误 #194
Comments
@zwr19971110 提供实例,不清楚你什么问题。 |
就是点击定位按钮,showAddressBar不是展示位置吗?就报错address为null,定位也没成功,但是没执行onLocationError |
Closed
@zwr19971110 我不太确认是不是百度 SDK的自身的问题。 我使 SDK 的官方例子,点击都没有反应。 // 添加定位事件
locationControl.addEventListener("locationSuccess", function(e){
var address = '';
address += e.addressComponent.province;
address += e.addressComponent.city;
address += e.addressComponent.district;
address += e.addressComponent.street;
address += e.addressComponent.streetNumber;
alert("当前定位地址为:" + address);
});
locationControl.addEventListener("locationError",function(e){
alert(e.message);
}); |
应该是百度自身 SDK 有问题,我看是内部报错 |
API 版本改成 v2 就可以 100% 成功了,看样还是 v3 不行 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VM12345:1 Uncaught TypeError: Cannot read property 'address' of null
at Geolocation.eval (eval at g_ (getscript?v=3.0&ak=SN5ZPOlev6PEveQvRWhKzR7bIp6q06dM&services=&t=20210830150006:1), :1:778)
at c (eval at g_ (getscript?v=3.0&ak=SN5ZPOlev6PEveQvRWhKzR7bIp6q06dM&services=&t=20210830150006:1), :1:1789)
at eval (eval at g_ (getscript?v=3.0&ak=SN5ZPOlev6PEveQvRWhKzR7bIp6q06dM&services=&t=20210830150006:1), :1:2566)
The text was updated successfully, but these errors were encountered: