From ad74b0a958c811782a516087cc7c6f094e9d7722 Mon Sep 17 00:00:00 2001 From: jonyshi Date: Mon, 28 Jan 2019 10:24:37 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0onDropBorder=20=E7=9A=84?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/demolist/Demo23.js | 4 ++-- src/TableHeader.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/demo/demolist/Demo23.js b/demo/demolist/Demo23.js index f64aa57..e0b61bf 100644 --- a/demo/demolist/Demo23.js +++ b/demo/demolist/Demo23.js @@ -61,8 +61,8 @@ class Demo23 extends Component { dragborder={true} draggable={true} - onDropBorder ={(e)=>{ - console.log("调整列宽后触发事件",e.target); + onDropBorder ={(e,width)=>{ + console.log(width+"--调整列宽后触发事件",e.target); }} />; } diff --git a/src/TableHeader.js b/src/TableHeader.js index 2bed5c0..8816d03 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -174,6 +174,7 @@ class TableHeader extends Component { let currentCols = this.table.cols[this.drag.currIndex]; let diff = (event.x - this.drag.oldLeft); let newWidth = this.drag.oldWidth + diff; + this.drag.newWidth = newWidth; // if(newWidth > this.drag.minWidth){ if(newWidth > this.minWidth){ currentCols.style.width = newWidth +'px'; @@ -181,7 +182,7 @@ class TableHeader extends Component { if(this.fixedTable.cols){ this.fixedTable.cols[this.drag.currIndex].style.width = newWidth + "px"; } - + //表头滚动条处理 if(headerScroll){ let oldTableWidth = parseInt(this.table.table.style.width ?this.table.table.style.width:this.table.table.scrollWidth); @@ -234,8 +235,9 @@ class TableHeader extends Component { * @memberof TableHeader */ onLineMouseUp = (event) => { + let width = this.drag.newWidth; this.clearDragBorder(event); - this.props.onDropBorder(event) + this.props.onDropBorder(event,width); }; /**