这是关于Meteor包的问题 - dburles:google-maps
。我设法正确添加它,我有一个谷歌地图,但我试图添加其他功能,尤其是自动完成插件。 Autocomplete for Google Maps查看相关文档,我不确定代码的哪些部分已包含在dburles:google-maps
中,因为启动地图的语法与Google的原始文档不同。
我的问题是在查看文档代码时应该考虑哪些部分,以及我应该忽略什么,因为它已经包含在包中了?
我显示正在运行的Google地图的代码
map.html
<template name="map">
<div class="map-container">
{{> googleMap name="locations" options=locationsOptions}}
</div>
</template>
map.js
// Loading map on startup
Meteor.startup(function() {
GoogleMaps.load();
});
Template.map.helpers({
locationsOptions: function() {
// Make sure the maps API has loaded
if (GoogleMaps.loaded()) {
// Map initialization options
return {
center: new google.maps.LatLng(52.524268, 13.406290),
zoom: 12
};
}
}
});