小编Mat*_*c24的帖子

尽管 API 已激活,但在尝试使用嵌入地图 API 时出现 ApiNotActivatedMapError

我在网页中嵌入了一张地图,但由于某种原因我不断收到 ApiNotActivatedMapError,我正在查看它并且它已被激活。我只是在这里不知所措。

<div id="map" style="width:100%;height:400px">My map will go here</div>

<script>
// Initialize and add the map
function initMap() {
    var mapProp= {
        center:new google.maps.LatLng(51.508742,-0.120850),
        zoom:5,
    };
    var map=new google.maps.Map(document.getElementById("map"),mapProp);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY&callback=initMap">
</script>
Run Code Online (Sandbox Code Playgroud)

有没有人有这个问题的经验?我错过了一些简单的东西吗?谢谢

html javascript google-maps google-api

3
推荐指数
1
解决办法
3631
查看次数

标签 统计

google-api ×1

google-maps ×1

html ×1

javascript ×1