am1*_*101 3 reactjs react-google-maps
我在地图上没有看到缩放 +/-、地图/卫星和人类图标。我正在按照文档中指定的步骤进行操作。有没有我必须通过的特定道具?或者有什么悬而未决的问题?谢谢你的帮助。
这是我的 GoogleMap 组件的片段 -
*
withScriptjs(
withGoogleMap(() => {
return (<GoogleMap
// google={google}
defaultZoom={8}
center={selectedAirportPos}
// center={{lat: 39.996944444444445, lng: -82.89194444444445 }}
// defaultCenter={{ lat: -34.397, lng: 150.644 }}
defaultOptions={{
// defaultCenter: {lat: -34.397, lng: 150.644 },
disableDefaultUI: true,
mapTypeId: 'terrain',//google.maps.MapTypeId.TERRAIN,
}}
>
<GMapsAirportMarker
withInfoWindow={allMarkersState[selectedAirport.id]}
withInfoWindowContent={this.selectedInfoWindowContent(selectedAirport)}
position={selectedAirportPos}
icon
Run Code Online (Sandbox Code Playgroud)
*
小智 5
您已将 disableDefaultUI 设置为 true。这将从地图中删除缩放、地图类型控件。如果您只希望用户可以使用特定的地图类型,您可以在 GoogleMap 组件中将 defaultMapTypeId 设置为一个 prop。
https://developers.google.com/maps/documentation/javascript/examples/control-disableUI
https://tomchentw.github.io/react-google-maps/#googlemap
| 归档时间: |
|
| 查看次数: |
4141 次 |
| 最近记录: |