我的github

如果地图不能正常显示,很大可能是以下原因:

  1. 确保安装所有的类库安装了,并且使用了所支持的版本。
  2. 确保Leaflet的CSS加载了。
  3. 确保你的地图容纳器有定义高度。

一般来说,都是2和3的原因。。

 https://www.cnblogs.com/2008nmj/p/14115275.html

react+leaflet入门Demo:https://www.giserdqy.com/secdev/leaflet/14482/

react中试用leaflet简单起步:https://blog.csdn.net/weixin_34319640/article/details/88865697

 

发现原因是:https://stackoverflow.com/questions/40365440/react-leaflet-map-not-correctly-displayed

不光要引用leaflet.css

而且,还要给map-container定义高度

1. 在index.js中引用leaflet.css

 

2. 在index.css中添加map-container

 

>>添加高德地图、天地图。。。等等

>>openstreetmap的语言设置

posted on 2021-04-09 09:34  XiaoNiuFeiTian  阅读(958)  评论(0编辑  收藏  举报