简体   繁体   English

我在使用 MarkerClusterer 时遇到问题

[英]I have trouble with MarkerClusterer

Can someone explain to me why MarkerClusterer shows 2 markers when there is only one marker!有人可以向我解释为什么 MarkerClusterer 在只有一个标记时会显示 2 个标记! this is my code:这是我的代码:

   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;

photo description照片描述

I got it!我知道了! because strictMode!Everything was fine when I deleted it!因为strictMode!当我删除它时一切都很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM