Ionic framework Ionic DevApp:谷歌地图未显示
我已经使用JavaScript SDK来显示地图Ionic framework Ionic DevApp:谷歌地图未显示,ionic-framework,ionic3,ionic-serve,ionic-devapp,Ionic Framework,Ionic3,Ionic Serve,Ionic Devapp,我已经使用JavaScript SDK来显示地图 它在浏览器上工作,但是当我在DeV应用程序上打开它时,页面显示空白页。 ionViewDidLoad(){ this.loadMap(); } loadMap(){ this.geolocation.getCurrentPosition().then((position) => { let latLng = new google.maps.LatLng(position.coords.latitu
它在浏览器上工作,但是当我在DeV应用程序上打开它时,页面显示空白页。
ionViewDidLoad(){
this.loadMap();
}
loadMap(){
this.geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
let mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
}, (err) => {
console.log(err);
});
}
尝试添加locationOption
let locationOptions={timeout:30000,enableHighAccurance:true}代码>
然后像这样传递到getCurrentPosition
this.geolocation.getCurrentPosition(locationOptions)位置)=>{
尝试添加位置选项
let locationOptions={timeout:30000,enableHighAccurance:true};
然后像这样传递到getCurrentPosition
this.geolocation.getCurrentPosition(locationOptions)位置)=>{