我已经使用 javascript 和 html 在谷歌地图上创建了一个新的小部件,添加了一个谷歌地图 api(http://maps.googleapis.com/maps/api/js?key=xxx&callback=xxx)资源,但是当我运行它时,给出错误说加载小部件资源失败。
下面是我的代码
请提供任何帮助
var map;
function initMap() {
map = new google.maps.Map(document.getElementById(
'map'), {
center: {
lat: -34.397,
lng: 150.644
},
zoom: 8
});
}
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
<div id="map"></div>
.