百度地图使用问题笔记

一.中心点在左上角

由于是隐藏状态下创建的地图,
这样会导致地图容器宽高为0,在宽高为0的容器上,中心点自然也是0了,即容器的左上角。

 两种解决方法:

setTimeout(function(){
map1.centerAndZoom(pt,13);
},100);

map1.addEventListener('resize',function(){
map1.centerAndZoom(pt,13);
});
原文地址:https://www.cnblogs.com/anyaran/p/4673083.html