现在我正在通过传递 bounds 参数来设置我的反应传单地图的边界,如下所示:
<div hidden={!this.props.hide && !this.props.toggle} className="map-container">
<Leaflet.Map ref='leaflet-map' bounds={ this.getBounds()} >
<Leaflet.TileLayer url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'/>
{ this.geoResults().map(this.renderMarker) }
</Leaflet.Map>
</div>
问题是有时会在地图的最外层(在视图中)呈现标记,因此除非我拖动地图或缩小一个点,否则标记甚至不可见。我试图用缓冲区解决这个问题,或者尝试绘制边界然后使用缩放缩小一次,但似乎没有任何效果。你们有什么想法吗?