React Google Maps API 无法获取标题

问题描述 投票:0回答:1

我正在使用react-google-maps/api包,我想更改地图的标题。关于如何做到这一点有什么建议吗?

我尝试在组件中添加标题,也尝试在组件的选项部分传递值,但它仍然不起作用。

 <GoogleMap
      mapContainerStyle={containerStyle}
      center={center}
      gestureHandling="greedy"
      onLoad={onLoad}
      onUnmount={onUnmount}
      options={{
        scrollwheel: true,
        disableDefaultUI: true,
        auto: true,
        noClear: true,
        backgroundColor: 'white',
        enableHighAccuracy: true,
        isFractionalZoomEnabled: true,
        scaleControlOptions: true,
        zoomControl: false,
        streetViewControl: false,
        mapTypeControl: false,
        fullscreenControl: false,
        zoom: 15,
        gestureHandling: 'greedy',
        
      }}          
    >
reactjs google-maps-api-3 react-google-maps-api
1个回答
0
投票

航向和倾斜仅支持矢量地图。为了使用矢量图,有两个步骤:

  1. 在您的地图管理空间中创建一个使用矢量地图的mapID。 (记得将MapType设置为
    Javascript
    ,选择
    Vector
    作为渲染类型,并勾选
    rotation
  2. options
    属性中设置标题,并在 options
     属性中设置 
    mapID
<GoogleMap
    mapContainerStyle={containerStyle}
    center={center}
    zoom={10}
    onLoad={onLoad}
    onUnmount={onUnmount}
    options = {{
        mapId: 'your-map-id',
        heading: 180
    }}
>
© www.soinside.com 2019 - 2024. All rights reserved.