Closed fufjvnvnf closed 7 years ago
0.2.7
macOS/Safari
class AMapboxViz extends React.Component { constructor(props){ super(props); const markers = this.props.locations; this.state={ useCluster: true, }; this.state = { markers }; } render(){ return ( <Map amapkey={'ba035e10b09acfc492d168adfd1b97cb'} center={{longitude: 110, latitude: 40}} zoom={5} > <Markers markers={this.state.markers} useCluster={this.state.useCluster} /> </Map> ); } }
function amapbox(slice, json){ const div = d3.select(slice.selector); div.selectAll('*').remove(); ReactDOM.render( <AMapboxViz {...json.data} />, div.node(), ); }
显示的地图的marker会cluster成圆圈。
仅显示了markers,并没有cluster起来。
好吧 是由于constructor内两个紧接着的this.state={},第二个把第一个overwrite了。
react-amap version
0.2.7
OS/Browers version
macOS/Safari
Reproduction Link
Steps to reproduce
What is Expected?
显示的地图的marker会cluster成圆圈。
What is actually happening?
仅显示了markers,并没有cluster起来。