2016-07-22 9 views
1

私はFramework7 htmlでcordova googleマップを統合しようとしていますが、そこにはマップが表示されません。通常のhtmlページと同様のコードを記述しています。どんな助力も高く評価されます。Cordova Map Framework7にロードされていません

// Wait for device API libraries to load 
// 
document.addEventListener("deviceready", onDeviceReady, false); 

// device APIs are available 
// 
function onDeviceReady() { 
    //navigator.geolocation.getCurrentPosition(onSuccess, onError); 
    var mapDiv = document.getElementById('map_canvas'); 
    var GOOGLE = new plugin.google.maps.LatLng(37.422858, -122.085065); 
    var map = plugin.google.maps.Map.getMap(mapDiv); 
    map.addEventListener(plugin.google.maps.event.MAP_READY, function() { 
     map.setCenter(GOOGLE); 
    }); 

} 
</script> 

答えて

0

あなたは非同期google libraryロードするためにdeviceready内domlistener使用しようと、google.maps.event.addDomListener(window, 'load', initialize);を使用する必要があります。デモアプリで遊ぶために

*function loadAsynchronousScript() { 
var script = document.createElement('script'); 
script.type = 'text/javascript'; 
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' +'&signed_in=true&callback=initialize'; 
document.body.appendChild(script); 
}* 

てみてください、このデモアプリケーションは、コルドバのためにGoogleマップSDKを使用しています。https://github.com/mapsplugin/cordova-plugin-googlemaps

関連する問題