Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 无法显示地图?_Google Maps_Google Maps Api 3_Meteor - Fatal编程技术网

Google maps 无法显示地图?

Google maps 无法显示地图?,google-maps,google-maps-api-3,meteor,Google Maps,Google Maps Api 3,Meteor,我正试图将谷歌地图添加到我的web应用程序中,但我现在得到的只是一个空白页面。不,是错误,只是空白页 我正在使用mrt:googlemaps包来使用googlemaps 这是我的谷歌地图页面: <template name="customerhome"> <div id="map-canvas" style="width:500px;height:500px;margin:10px auto"></div> </template>

我正试图将谷歌地图添加到我的web应用程序中,但我现在得到的只是一个空白页面。不,是错误,只是空白页

我正在使用mrt:googlemaps包来使用googlemaps

这是我的谷歌地图页面:

<template name="customerhome">  
    <div id="map-canvas" style="width:500px;height:500px;margin:10px auto"></div>
</template>  

非常感谢您的帮助

将它包装到Meteor.isClient中,我认为,由于它试图在客户端和服务器上运行它,它正在崩溃fwiw这里有一个meteorpad:meteorpad.com/pad/X2CsxkZ2LgmCrkT2H/Maps。在API键警告出现之前,我可以看到贴图渲染几秒钟。我建议将map init放在onRendered内,我很惊讶它在onRendered外工作。没关系,它工作了,只是需要删除app.js中的新mongo.collection将其包装到Meteor.isClient中,我认为,由于它试图在客户端和服务器上同时运行它,它正在崩溃。这里有一个meteorpad:meteorpad.com/pad/X2CsxkZ2LgmCrkT2H/Maps。在API键警告出现之前,我可以看到贴图渲染几秒钟。我建议将map init放在onRendered内,我很惊讶它在onRendered外工作。更不用说它工作了,只需删除app.js中的新mongo.collection
UserAccounts = new Mongo.Collection('users'); 

GoogleMaps.init(
    {
        'sensor': true, //optional
        'key': 'MY-GOOGLEMAPS-API-KEY', //optional
        'language': 'de' //optional
    }, 
    function(){
        var mapOptions = {
            zoom: 13,
            mapTypeId: google.maps.MapTypeId.SATELLITE
        };
        map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); 
        map.setCenter(new google.maps.LatLng( 35.363556, 138.730438 ));
    }
);