From 50b18576a7e51da5758ac4dae116923f2e1eff64 Mon Sep 17 00:00:00 2001 From: jonyshi Date: Thu, 18 Apr 2019 14:23:59 +0800 Subject: [PATCH] =?UTF-8?q?=20drag=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/dragColumn.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/dragColumn.js b/src/lib/dragColumn.js index d8f6e7b..2a44b20 100644 --- a/src/lib/dragColumn.js +++ b/src/lib/dragColumn.js @@ -77,9 +77,21 @@ export default function dragColumn(Table) { 0, columns.splice(sourceIndex, 1)[0] ); - this.setState({ - columns:cloneDeep(columns) + // this.setState({ + // columns:cloneDeep(columns) + // }); + let _newColumns = []; + columns.forEach((da,i)=>{ + let newDate = Object.assign(da,{}); + newDate.title = da.title; + _newColumns.push(newDate); }); + // console.log(" onDrop-------columns--- ",columns); + this.setState({ + columns:_newColumns//cloneDeep(columns) + }); + // console.log(" onDrop-------columns--- ",_newColumns); + console.log(columns === _newColumns); if(this.props.onDrop){ this.props.onDrop(event,data,columns); }