大家好,我正在使用meteor-google-map。我可以在桌面上看到它们,但在移动设备上看不到它们。谁能告诉我我做错了什么?在移动设备上, map 容器全是空白的。这是一张图片
如果我必须将域列入白名单,那么有人可以告诉我如何将谷歌地图列入白名单,因为来自文档
tel:, geo:, mailto:, sms:, market:* are allowed and launch externally (phone app, or an email client on Android)
我认为谷歌地图是允许的
这是谷歌地图代码
index.html
<div class="map-container">
{{> googleMap name="exampleMap" options=exampleMapOptions}}
</div>
index.js
exampleMapOptions: function() {
// Make sure the maps API has loaded
if (GoogleMaps.loaded()) {
// Map initialization options
return {
center: new google.maps.LatLng(Meteor.user().profile.latitude, Meteor.user().profile.longitude),
zoom: 13
};
}
}
Template.body.onCreated(function() {
// We can use the `ready` callback to interact with the map API once the map is ready.
GoogleMaps.ready('exampleMap', function(map) {
// Add a marker to the map once it's ready
var marker = new google.maps.Marker({
position: map.options.center,
map: map.instance
});
});
});
更新
我发现我遇到了错误“ Uncaught ReferenceError :谷歌未定义”
所以我尝试了白名单,但它不起作用
> App.info({ id: 'com.example.matt.uber',
>name: 'MedCircle',
> description: 'Get über power in one button click',
>author: 'Matt
> Development Group',
>email: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="660509081207051226031e070b160a034805090b" rel="noreferrer noopener nofollow">[email protected]</a>',
>website: 'http://example.com'
>});
>
> App.setPreference('BackgroundColor', '0xff0000ff');
> App.setPreference('HideKeyboardFormAccessoryBar', true);
> App.setPreference('Orientation', 'default');
>
>
> // App.accessRule('*.googleapis.com');
> //App.accessRule('*.gstatic.com');
>// App.accessRule('*.google.com'); //
>// App.accessRule('maps.googleapis.com');
>// App.accessRule('maps.gstatic.com');
>// App.accessRule('mt0.googleapis.com');
>// App.accessRule('mt1.googleapis.com');
>// App.accessRule('csi.gstatic.com');
>
>
> // <access origin="*://*.googleapis.com/*" subdomains="true" />
> //<access origin="*://*.gstatic.com/*" subdomains="true" />
> // <accessorigin="*://*.google.com/*" subdomains="true" />
> // <accessorigin="*://*.googleusercontent.com/*" subdomains="true" />
>
> App.accessRule('*');
最佳答案
我发现我必须允许这些
App.accessRule('http://*');
App.accessRule('https://*');
关于google-maps - 谷歌地图不显示在手机上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33101792/