|
|
@@ -89,16 +89,17 @@ class TableModel extends React.Component {
|
|
|
let node = this.refs.body;
|
|
|
let title = node.getElementsByClassName('rc-table-title')[0] || { offsetHeight: 0 };
|
|
|
let thead = node.getElementsByClassName('rc-table-thead')[0];
|
|
|
- this.cHeight = node.offsetHeight - title.offsetHeight - 4;
|
|
|
+ this.cHeight = node.offsetHeight - 4 - title.offsetHeight; // 这里的4是上下padding和border
|
|
|
let trHeight = (this.cHeight) / (this.rowCount + 1);
|
|
|
- thead.style.fontSize = pageSize ? `${fontSize/.6 > trHeight ? trHeight * .6 : fontSize}px` : `${trHeight * .6}px`;
|
|
|
+ let trFontSize = pageSize ? `${fontSize/.6 > trHeight ? trHeight * .6 : fontSize}px` : `${trHeight * .6}px`;
|
|
|
+ thead.style.fontSize = trFontSize;
|
|
|
+ thead.getElementsByTagName('th')[0].style.height = `${trHeight}px` ;
|
|
|
let count = this.state.data.length;
|
|
|
if (count == 0) { return; }
|
|
|
let trs = node.getElementsByClassName('fade-enter');
|
|
|
for (let i = 0; i < trs.length; i++) {
|
|
|
- let trHeight = (this.cHeight - thead.offsetHeight) / (this.rowCount);
|
|
|
+ trs[i].style.fontSize = trFontSize;
|
|
|
trs[i].style.height = `${trHeight}px` ;
|
|
|
- trs[i].style.fontSize = pageSize ? `${fontSize/.6 > trHeight ? trHeight * .6 : fontSize}px` : `${trHeight * .6}px`;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -107,7 +108,6 @@ class TableModel extends React.Component {
|
|
|
let node = this.refs.body;
|
|
|
let title = node.getElementsByClassName('rc-table-title')[0] || { offsetHeight: 0 };
|
|
|
let rows = node.getElementsByClassName('rc-table-row');
|
|
|
- let alignWidth = 0; // 该值等于((@horizontal-padding)*2+(border宽度*2))
|
|
|
if (rows.length > 0) {
|
|
|
let cells = rows[0].cells || [];
|
|
|
let oldTrs = node.getElementsByClassName('fade-leave') || [];
|