谁能给我解释一下为什么MarkerClusterer只有一个标记时会显示两个标记!这是我的代码:
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;照片描述
发布于 2020-09-04 14:34:25
这样啊,原来是这么回事!因为strictMode!当我删除它的时候,一切都很好!
https://stackoverflow.com/questions/63735077
复制相似问题