diff --git a/build/TableHeader.js b/build/TableHeader.js index bffe703..8e1c81f 100644 --- a/build/TableHeader.js +++ b/build/TableHeader.js @@ -127,10 +127,7 @@ var TableHeader = function (_Component) { }; _this.onLineMouseUp = function (event) { - var rows = _this.props.rows; - var data = { rows: rows[0], cols: _this.table.cols, currIndex: _this.drag.currIndex }; - _this.props.afterDragColWidth && _this.props.afterDragColWidth(data); _this.clearDragBorder(event); }; @@ -446,7 +443,11 @@ var TableHeader = function (_Component) { TableHeader.prototype.clearDragBorder = function clearDragBorder() { // if (!this.props.dragborder || !this.props.draggable) return; - if (!this.drag) return; + if (!this.drag || !this.drag.option) return; + var rows = this.props.rows; + + var data = { rows: rows[0], cols: this.table.cols, currIndex: this.drag.currIndex }; + this.props.afterDragColWidth && this.props.afterDragColWidth(data); this.drag = { option: "" }; diff --git a/src/TableHeader.js b/src/TableHeader.js index 06964a1..855f9e5 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -210,9 +210,7 @@ class TableHeader extends Component { }; onLineMouseUp = (event) => { - let {rows} = this.props; - let data = {rows:rows[0],cols:this.table.cols,currIndex:this.drag.currIndex}; - this.props.afterDragColWidth && this.props.afterDragColWidth(data); + this.clearDragBorder(event); }; bodyonLineMouseMove = (event) => { @@ -221,7 +219,10 @@ class TableHeader extends Component { clearDragBorder(){ // if (!this.props.dragborder || !this.props.draggable) return; - if(!this.drag)return; + if(!this.drag || !this.drag.option)return; + let {rows} = this.props; + let data = {rows:rows[0],cols:this.table.cols,currIndex:this.drag.currIndex}; + this.props.afterDragColWidth && this.props.afterDragColWidth(data); this.drag = { option:"" }; @@ -281,7 +282,6 @@ class TableHeader extends Component { let event = Event.getEvent(e); if (!this.props.draggable) return; if(this.drag.option === 'border'){return;} - console.log(this.drag.option+' -------onDragStart----------',event.target); let th = this.getThDome(event.target); if(!th)return; let currentIndex = parseInt(th.getAttribute("data-line-index")); @@ -318,7 +318,6 @@ class TableHeader extends Component { this.currentDome.setAttribute('draggable',false);//添加交换列效果 let data = this.getCurrentEventData(e); if(!data)return; - console.log(this.drag.option+' -------onDrop----------',event.target); if (!this.currentObj || this.currentObj.key == data.key) return; if(!this.props.onDrop)return; this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:data});