HarmonyOS 地图组件接入后不显示地图,只显示图标,官网的demo也有同样的问题?

aboutToAppear(): void {
  this.callLocationStart()
  this.callDevice()
  let target: mapCommon.LatLng = {
    latitude: this.latitude,
    longitude: this.longitude
  };
  let cameraPosition: mapCommon.CameraPosition = {
    target: target,
    zoom: 15
  };
  this.mapOptions = {
    position: cameraPosition
  };
  this.callback = async (err, mapController) => {
    if (!err) {
      this.mapController = mapController;
      let markerOptions: mapCommon.MarkerOptions = {
        position: {
          latitude: this.latitude,
          longitude: this.longitude
        }
      };
      await this.mapController?.addMarker(markerOptions);
    }
  };
}

@Builder buildContentView() {
  Column() {

    this.Title()

    MapComponent({ mapOptions: this.mapOptions, mapCallback: this.callback })
      .width('100%')
      .height('100%')
  }
  .width('100%')
  .height('100%')
}
阅读 635
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
logo
HarmonyOS
子站问答
访问
宣传栏