fix: 固定列中,元素高度保留两位小数

This commit is contained in:
gx 2021-02-21 13:35:10 +08:00
parent df2fd6d32c
commit 816617051a
3 changed files with 8 additions and 8 deletions

6
dist/demo.js vendored
View File

@ -49245,9 +49245,9 @@
rightHeight = void 0,
currentHeight = void 0,
maxHeight = void 0;
leftHeight = leftBodyRows[index] ? parseInt(leftBodyRows[index].getBoundingClientRect().height) : 0;
rightHeight = rightBodyRows[index] ? parseInt(rightBodyRows[index].getBoundingClientRect().height) : 0;
currentHeight = parseInt(row.getBoundingClientRect().height);
leftHeight = leftBodyRows[index] ? Number(leftBodyRows[index].getBoundingClientRect().height).toFixed(2) : 0; // 有些浏览器中取到的高度是小数直接parseInt有问题保留两位小数处理
rightHeight = rightBodyRows[index] ? Number(rightBodyRows[index].getBoundingClientRect().height).toFixed(2) : 0;
currentHeight = Number(row.getBoundingClientRect().height).toFixed(2);
maxHeight = Math.max(leftHeight, rightHeight, currentHeight);
return maxHeight || 'auto';
} else {

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1246,13 +1246,13 @@ class Table extends Component {
// 内容折行显示,并又设置了 height 的情况下,也要获取主表高度
if(heightConsistent || (!bodyDisplayInRow && rsHeight)){
let leftHeight,rightHeight,currentHeight,maxHeight;
leftHeight = leftBodyRows[index]?parseInt(leftBodyRows[index].getBoundingClientRect().height):0;
rightHeight = rightBodyRows[index]?parseInt(rightBodyRows[index].getBoundingClientRect().height):0;
currentHeight = parseInt(row.getBoundingClientRect().height)
leftHeight = leftBodyRows[index]?Number(leftBodyRows[index].getBoundingClientRect().height).toFixed(2):0; // 有些浏览器中取到的高度是小数直接parseInt有问题保留两位小数处理
rightHeight = rightBodyRows[index]?Number(rightBodyRows[index].getBoundingClientRect().height).toFixed(2):0;
currentHeight = Number(row.getBoundingClientRect().height).toFixed(2)
maxHeight = Math.max(leftHeight,rightHeight,currentHeight);
return maxHeight || 'auto'
}else{
return parseInt(row.getBoundingClientRect().height) || 'auto'
return Number((Number(row.getBoundingClientRect().height)).toFixed(2)) || 'auto';
}
}
}