drag 优化

This commit is contained in:
jonyshi 2019-04-18 14:23:59 +08:00
parent 707c1a98ed
commit 50b18576a7
1 changed files with 14 additions and 2 deletions

View File

@ -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);
}