Merge pull request #1167 from lcx960324/2.0

bugfix on transfer
This commit is contained in:
Aresn 2017-06-15 15:02:54 +08:00 committed by GitHub
commit 8b73f45bf7
2 changed files with 9 additions and 9 deletions

View file

@ -164,7 +164,7 @@
export default {
data () {
return {
data1: this.getMockData(),
data1: [] || this.getMockData(),
targetKeys1: this.getTargetKeys()
}
},

View file

@ -194,14 +194,14 @@
this.rightData = [];
if (this.targetKeys.length > 0) {
this.targetKeys.forEach((targetKey) => {
this.rightData.push(
this.leftData.filter((data, index) => {
if (data.key === targetKey) {
this.leftData.splice(index, 1);
return true;
}
return false;
})[0]);
const filteredData = this.leftData.filter((data, index) => {
if (data.key === targetKey) {
this.leftData.splice(index, 1);
return true;
}
return false;
});
if (filteredData && filteredData.length > 0) this.rightData.push(filteredData[0]);
});
}
if (init) {