优化 TableHeightAdaption 组件

This commit is contained in:
hooray 2022-01-06 01:14:39 +08:00
parent 1ff85c7bea
commit c195fd2bc2

View File

@ -7,9 +7,12 @@
<script setup name="TableHeightAdaption">
onMounted(() => {
nextTick(() => {
// .el-table__body-wrapper height
// .el-table__body-wrapper .el-table__fixed-body-wrapper height
let height = document.getElementsByClassName('el-table__header-wrapper')[0].offsetHeight
document.getElementsByClassName('el-table__body-wrapper')[0].style.height = `calc(100% - ${height}px)`
for (let item of document.getElementsByClassName('el-table__fixed-body-wrapper')) {
item.style.height = `calc(100% - ${height}px)`
}
})
})
</script>