mirror of https://github.com/ElemeFE/element
Table: fix 修复 table 多级表头在固定时一级表头宽度不随子级表头宽度拖拽更新问题
parent
5d7374bf16
commit
3b09a76774
|
@ -129,6 +129,13 @@ class TableLayout {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFixedColumnWidth(column) {
|
||||||
|
if (column.children) {
|
||||||
|
return column.children.reduce((pre, cur) => pre + this.getFixedColumnWidth(cur), 0);
|
||||||
|
}
|
||||||
|
return column.realWidth || column.width;
|
||||||
|
}
|
||||||
|
|
||||||
updateColumnsWidth() {
|
updateColumnsWidth() {
|
||||||
if (Vue.prototype.$isServer) return;
|
if (Vue.prototype.$isServer) return;
|
||||||
const fit = this.fit;
|
const fit = this.fit;
|
||||||
|
@ -198,8 +205,8 @@ class TableLayout {
|
||||||
|
|
||||||
if (fixedColumns.length > 0) {
|
if (fixedColumns.length > 0) {
|
||||||
let fixedWidth = 0;
|
let fixedWidth = 0;
|
||||||
fixedColumns.forEach(function(column) {
|
fixedColumns.forEach((column) => {
|
||||||
fixedWidth += column.realWidth || column.width;
|
fixedWidth += this.getFixedColumnWidth(column);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fixedWidth = fixedWidth;
|
this.fixedWidth = fixedWidth;
|
||||||
|
@ -208,8 +215,8 @@ class TableLayout {
|
||||||
const rightFixedColumns = this.store.states.rightFixedColumns;
|
const rightFixedColumns = this.store.states.rightFixedColumns;
|
||||||
if (rightFixedColumns.length > 0) {
|
if (rightFixedColumns.length > 0) {
|
||||||
let rightFixedWidth = 0;
|
let rightFixedWidth = 0;
|
||||||
rightFixedColumns.forEach(function(column) {
|
rightFixedColumns.forEach((column) => {
|
||||||
rightFixedWidth += column.realWidth || column.width;
|
rightFixedWidth += this.getFixedColumnWidth(column);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rightFixedWidth = rightFixedWidth;
|
this.rightFixedWidth = rightFixedWidth;
|
||||||
|
|
Loading…
Reference in New Issue