【发布时间】:2020-12-23 08:48:21
【问题描述】:
有人可以向我解释为什么 MarkerClusterer 在只有一个标记时会显示 2 个标记! 这是我的代码:
const MapWithMarkerClusterer = compose(
withProps({
googleMapURL:
"https://maps.googleapis.com/maps/api/jskey=API_KEY&v=3.exp&
libraries=geometry,drawing,places",
loadingElement: <div style={{ height: `100%` }} />,
containerElement: <div style={{ height: `400px` }} />,
mapElement: <div style={{ height: `100%` }} />,
center: { lat: 25.03, lng: 121.6 },
}),
withScriptjs,
withGoogleMap
)((props) => (
<GoogleMap
defaultZoom={10}
defaultCenter={{ lat: 19.807151, lng: 105.795327 }}
>
<MarkerClusterer averageCenter enableRetinaIcons gridSize={100}>
<Marker
position={{
lat: 19.807151,
lng: 105.795327,
}}
/>
</MarkerClusterer>
</GoogleMap>
));
export default MapWithMarkerClusterer;
照片说明
【问题讨论】:
-
没有照片亲爱的Conqueror135。
-
我删除了您问题中的 API 密钥。今后请不要在公共网站上分享您的 API 密钥。
标签: javascript reactjs google-maps react-google-maps