2015-06-25 21 views

回答

1

你必须加载Google Maps API js file第一然后gmaps.js。看看这个updated fiddle

<script type='text/javascript' src="https://maps.google.com/maps/api/js?sensor=true"></script> 
<script type='text/javascript' src="https://hpneo.github.io/gmaps/gmaps.js"></script> 

在你的文章中,gmaps.js文件被加载第一,但浏览器无法找到任何来自谷歌地图API的文件所需的方法。您可以在给出的链接上阅读更多关于Load and Execute order of scripts的文章。