Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.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 我在运行使用map和mapOptions的ionic 2应用程序时遇到问题, 运行时错误_Google Maps_Typescript_Ionic Framework - Fatal编程技术网

Google maps 我在运行使用map和mapOptions的ionic 2应用程序时遇到问题, 运行时错误

Google maps 我在运行使用map和mapOptions的ionic 2应用程序时遇到问题, 运行时错误,google-maps,typescript,ionic-framework,Google Maps,Typescript,Ionic Framework,错误: 类型“{zoom:number;minZoom:number;center:LatLng;mapTypeId:mapTypeId;disableDefaultUI:true;sc..”不可分配给类型“MapOptions”。属性“styles”的类型不兼容。类型“{featureType:string;elementType:string;stylers:{visibility:string;}[]”不可分配给类型“MapTypeStyle[]”。类型{featureType:strin

错误:

类型“{zoom:number;minZoom:number;center:LatLng;mapTypeId:mapTypeId;disableDefaultUI:true;sc..”不可分配给类型“MapOptions”。属性“styles”的类型不兼容。类型“{featureType:string;elementType:string;stylers:{visibility:string;}[]”不可分配给类型“MapTypeStyle[]”。类型{featureType:string;elementType:string;stylers:{visibility:string;}[];}'不可分配给类型“MapTypeStyle”。属性“elementType”的类型不兼容。类型“string”不可分配给类型“MapTypeStyleElementType”

截图:


您是否能够解决此问题?您是否尝试先删除
样式
属性来隔离错误?您的
样式数组可能有问题
是否能够解决此问题?您是否尝试先删除
样式
属性来隔离错误?您的
样式可能有问题数组
return this.loadMap().then(() => {
  const myLatLng = new google.maps.LatLng(opts.lat, opts.lon);
  const styleArray = [
    {
      featureType: 'poi',
      elementType: 'labels',
      stylers: [
        {visibility: 'off'}
      ]
    }
  ];

  const mapOptions: google.maps.MapOptions = { // this variable gives error
    zoom: opts.zoom,
    minZoom: opts.zoom,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    disableDefaultUI: true,
    scaleControl: false,
    styles: styleArray,
    zoomControl: false,
    zoomControlOptions: {
      position: google.maps.ControlPosition.BOTTOM_CENTER
    }
  };

  this.map = new google.maps.Map(mapEl, mapOptions);
  return this.map;
});
}