我正在使用包
react-google-maps/api
并且想要更改地图的标题。关于如何做到这一点有什么建议吗?
我尝试在
<GoogleMap/>
组件中添加标题,并且还尝试在组件的 options
部分中传递值,但它仍然不起作用。
<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',
}}
>
航向和倾斜仅支持矢量地图。为了使用矢量图,有两个步骤:
Javascript
,选择Vector
作为渲染类型,并勾选rotation
)options
属性中设置标题,根据 PR,mapID 也需要位于 options
属性中。<GoogleMap
mapContainerStyle={containerStyle}
center={center}
zoom={10}
onLoad={onLoad}
onUnmount={onUnmount}
options = {{
mapId: 'your-map-id',
heading: 180
}}
>