update Table

update Table
This commit is contained in:
梁灏 2017-01-05 13:15:26 +08:00
parent f23d6ba1ac
commit 3d6fa54b39
5 changed files with 288 additions and 74 deletions

View file

@ -11,15 +11,22 @@ export default {
isPopperShow (column) {
return column.filters && ((!this.fixed && !column.fixed) || (this.fixed === 'left' && column.fixed === 'left') || (this.fixed === 'right' && column.fixed === 'right'));
},
setCellWidth (column) {
// return column.width ? column.width : this.columnsWidth[index];
setCellWidth (column, index, top) {
let width = '';
if (column.width) {
width = column.width;
} else if (this.columnsWidth[column._index]) {
width = this.columnsWidth[column._index].width;
}
// return this.columnsWidth[column._index] ? this.columnsWidth[column._index].width : '';
// when browser has scrollBar,set a width to resolve scroll position bug
if (this.columns.length === index + 1 && top) {
width += this.$parent.scrollBarWidth;
}
// when fixed type,reset first right fixed column's width
if (this.fixed === 'right') {
const firstFixedIndex = this.columns.findIndex((col) => col.fixed === 'right');
if (firstFixedIndex === index) width += this.$parent.scrollBarWidth;
}
return width;
}
}