鍍金池/ 問答/HTML5  HTML/ react+antd 渲染table內(nèi)容時, 屏幕高度被拉長了。

react+antd 渲染table內(nèi)容時, 屏幕高度被拉長了。

使用react+antd做一個簡單項目時,向以下代碼中的Table做了記錄的重繪,所有的布局的height和width都采用了百分比的方式,table里面的資料少時,界面正常,記錄一多,內(nèi)容高度大與div高度時,界面就被拉伸了,我給table設(shè)置了自動滾輪,拉伸的目測是外邊整個div的高度,何解?
<Row style={{background: '#ddf2da',height: '77.5%'}}>

<Col span="16" style={{background: '#fff',height: '100%'}}>
 <Row type="flex" justify="center" style={{background: '#7ed37a', height: '7.5%' }}>
   <Col><h2>查詢結(jié)果</h2></Col>
 </Row>
<div style={{overflow:"auto",background: '#fff', height:'92.5%'}}>
     <Table  columns={columns} dataSource={this.state.dataLst} />
 </div>

</Col>

<Col span="8"  style={{background: '#fff',height: '100%'}}>
  <Row style={{background: '#52f',height: '75%'}}>
     <Col span="24">
     </Col>
  </Row>
  <Row style={{background: '#fff',height: '25%'}}>
     <Col span="24">
     </Col>
  </Row>

</Col>
</Row>

回答
編輯回答
貓館

<Table columns={columns} dataSource={data} scroll={{ y: 你需要的高度 }}

多看文檔

2017年12月13日 06:53