From 8aea29060a2e635a363e831cdab4a4f9faa14803 Mon Sep 17 00:00:00 2001 From: jonyshi Date: Wed, 26 Jun 2019 17:50:04 +0800 Subject: [PATCH] build --- build/TableHeader.js | 7 +++++-- src/TableHeader.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build/TableHeader.js b/build/TableHeader.js index 7e53c9c..be8857d 100644 --- a/build/TableHeader.js +++ b/build/TableHeader.js @@ -169,14 +169,16 @@ var TableHeader = function (_Component) { // const newTableWidth = this.drag.tableWidth + diff;// +'px'; // this.table.table.style.width = newTableWidth+'px';;//改变table的width // if(this.table.innerTableBody){//TODO 后续需要处理此处 - // this.table.innerTableBody.style.width = newTableWidth+'px'; ; + // this.table.innerTableBody.style.width = newTableWidth+'px'; + // } var newDiff = parseInt(currentCols.style.minWidth) - parseInt(currentCols.style.width); if (newDiff > 0) { //缩小 var lastWidth = _this.lastColumWidth + newDiff; - _this.table.cols[lastShowIndex].style.width = lastWidth + "px"; + _this.table.cols[lastShowIndex].style.width = lastWidth + "px"; //同步表头 + _this.table.tableBodyCols[lastShowIndex].style.width = lastWidth + "px"; //同步表体 } var showScroll = contentDomWidth - (_this.drag.tableWidth + diff) - scrollbarWidth; @@ -512,6 +514,7 @@ var TableHeader = function (_Component) { table.cols = tableDome.getElementsByTagName("col"); table.ths = tableDome.getElementsByTagName("th"); table.tr = tableDome.getElementsByTagName("tr"); + table.tableBodyCols = contentTable.querySelector('.u-table-scroll .u-table-body').getElementsByTagName("col"); } table.fixedLeftHeaderTable = contentTable.querySelector('.u-table-fixed-left .u-table-header'); diff --git a/src/TableHeader.js b/src/TableHeader.js index 2b57e53..a8df4cd 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -76,6 +76,7 @@ class TableHeader extends Component { table.cols = tableDome.getElementsByTagName("col"); table.ths = tableDome.getElementsByTagName("th"); table.tr = tableDome.getElementsByTagName("tr"); + table.tableBodyCols = contentTable.querySelector('.u-table-scroll .u-table-body').getElementsByTagName("col"); } table.fixedLeftHeaderTable = contentTable.querySelector('.u-table-fixed-left .u-table-header') ; @@ -274,13 +275,15 @@ class TableHeader extends Component { // const newTableWidth = this.drag.tableWidth + diff;// +'px'; // this.table.table.style.width = newTableWidth+'px';;//改变table的width // if(this.table.innerTableBody){//TODO 后续需要处理此处 - // this.table.innerTableBody.style.width = newTableWidth+'px'; ; + // this.table.innerTableBody.style.width = newTableWidth+'px'; + // } let newDiff = (parseInt(currentCols.style.minWidth) - parseInt(currentCols.style.width)); if(newDiff > 0){//缩小 let lastWidth = this.lastColumWidth + newDiff; - this.table.cols[lastShowIndex].style.width = lastWidth +"px"; + this.table.cols[lastShowIndex].style.width = lastWidth +"px";//同步表头 + this.table.tableBodyCols[lastShowIndex].style.width = lastWidth + "px";//同步表体 } let showScroll = contentDomWidth - (this.drag.tableWidth + diff) - scrollbarWidth ;