微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

自 v2.0.0 以来,如何将 props 传递给 React Leaflet.markercluster 选项?

如何解决自 v2.0.0 以来,如何将 props 传递给 React Leaflet.markercluster 选项?

我尝试使用 function EnhancedTableHead(props) { ... return ( <TableHead> <TableRow> <TableCell padding="checkBox"> {/* How to get the checked prop below and send it to parent component */} <CheckBox indeterminate={numSelected > 0 && numSelected < rowCount} checked={rowCount > 0 && numSelected === rowCount} onChange={onSelectAllClick} inputProps={{ "aria-label": "select all desserts" }} /> </TableCell> </TableRow> </TableHead>

传递属性

by <MarkerClusterGroup {...markerclusterOptions}> 但我认为这不是一个方法,因为它不起作用!

在文档中(#React Leaflet markercluster v2.0.0): 从现在开始,您不需要使用 let markerclusterOptions propLeaflet.markercluster option 传递给 options

我不明白该怎么做。

<MarkerClusterGroup />

解决方法

很可能是打字错误:

let markerclusterOptions: { // with colon ":" you declare a type
  maxClusterRadius: 10;
  spiderfyDistanceMultiplier: 2;
  spiderfyOnMaxZoom: true;
  showCoverageOnHover: false;
  zoomToBoundsOnClick: true;
}; // no assignment,value is undefined

应该是:

let markerclusterOptions = { // with equal you assign a value
  maxClusterRadius: 10,spiderfyDistanceMultiplier: 2,spiderfyOnMaxZoom: true,showCoverageOnHover: false,zoomToBoundsOnClick: true,};

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。