【发布时间】:2017-04-24 04:59:43
【问题描述】:
在这里反应新手,请多多包涵 :) 希望这很容易解决
目前,我只是想让地图出现在屏幕上,但是当我运行代码时,页面完全是空白的,甚至我的其他 div 也没有出现。这是我的代码,要点:https://gist.github.com/JoeyBodnar/f76c5d434d57c6cc6108513ad79d4cb7
需要注意的几点:1) 从项目目录中,我已经运行了 npm install --save react-google-maps 2) 使地图出现的代码取自这里:https://github.com/tomchentw/react-google-maps
那么我到底做错了什么?我在错误的地方声明“const GettingStartedGoogleMap”吗?还是我在 div 中做错了什么?
还要注意,如果我从该文件中删除所有与谷歌地图相关的代码,一切都会正常工作。
感谢任何帮助,谢谢
编辑,这是我的代码,即使是硬编码高度仍然显示空白屏幕:
return (
<GettingStartedGoogleMap
containerElement={
<div style={{ height: `400px` }} />
}
mapElement={
<div style={{ height: `400px` }} />
}
onMapLoad={_.noop}
onMapClick={_.noop}
markers={markers}
onMarkerRightClick={_.noop}
/>
);
【问题讨论】:
-
您是否遇到了一些控制台错误? sn-p 可能是必须的
标签: google-maps reactjs