fix a table fixed-column height bug

pull/2/head
Leopoldthecoder 2016-08-31 11:13:21 +08:00
parent c4a87761e3
commit f6261d219a
1 changed files with 15 additions and 0 deletions

View File

@ -421,6 +421,21 @@
const style = this.$refs.fixed.style;
if (!style) return;
style.height = this.$el.clientHeight + 'px';
// ,
let bodyHeight = this.$el.querySelector('.el-table__body-wrapper').offsetHeight;
let fixedBodyHeight = this.$el.querySelector('.el-table__fixed-body-wrapper').offsetHeight;
if (bodyHeight !== fixedBodyHeight) {
let bodyTrs = this.$el.querySelector('.el-table__body-wrapper').querySelectorAll('tr');
let fixedBodyTrs = this.$el.querySelector('.el-table__fixed-body-wrapper').querySelectorAll('tr');
bodyTrs.forEach((tr, index) => {
let trHeight = tr.offsetHeight;
let fixedTrHeight = fixedBodyTrs[index].offsetHeight;
if (trHeight !== fixedTrHeight) {
fixedBodyTrs[index].style.height = trHeight + 'px';
}
});
}
});
}
},