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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.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 在Meteor中显示谷歌地图问题?_Google Maps_Meteor - Fatal编程技术网

Google maps 在Meteor中显示谷歌地图问题?

Google maps 在Meteor中显示谷歌地图问题?,google-maps,meteor,Google Maps,Meteor,我需要知道如何在Meteor中显示google地图。我做了一个示例,如下所示 Html代码: <head> <title>Maps</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> </head> <body> {{> map

我需要知道如何在Meteor中显示google地图。我做了一个示例,如下所示

Html代码:

<head>
  <title>Maps</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">   </script>

</head>

<body>

  {{> maps }}

</body>

<template name="maps">
    <div id="map-canvas"></div>
</template>
问题是当我运行代码时没有显示地图。我对此一无所知。所以请建议我如何处理

Lets put the map on a initialize function like this.



       initMap = function(){
    console.log("*** Map  Start ********")
            var mapOptions = {
              center: new google.maps.LatLng(-34.397, 150.644),
              zoom: 8,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("map-canvas"),
                mapOptions);
            console.log("*** Map  end ********")
    }


        //return map;
现在是渲染函数

Template.maps.rendered = function(){
       Meteor.setTimeout(function(){
        initMapa();
         },2500)
       }
还要确保您有这样的.css文件

#map-canvas { 
width: 100%; 
height: 300px; 
}

它应该能工作,测试它,告诉我即使没有地图也能工作。那么我能做什么?@Ethaan
#map-canvas { 
width: 100%; 
height: 300px; 
}