commit
8b73f45bf7
2 changed files with 9 additions and 9 deletions
|
@ -164,7 +164,7 @@
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
data1: this.getMockData(),
|
data1: [] || this.getMockData(),
|
||||||
targetKeys1: this.getTargetKeys()
|
targetKeys1: this.getTargetKeys()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -194,14 +194,14 @@
|
||||||
this.rightData = [];
|
this.rightData = [];
|
||||||
if (this.targetKeys.length > 0) {
|
if (this.targetKeys.length > 0) {
|
||||||
this.targetKeys.forEach((targetKey) => {
|
this.targetKeys.forEach((targetKey) => {
|
||||||
this.rightData.push(
|
const filteredData = this.leftData.filter((data, index) => {
|
||||||
this.leftData.filter((data, index) => {
|
|
||||||
if (data.key === targetKey) {
|
if (data.key === targetKey) {
|
||||||
this.leftData.splice(index, 1);
|
this.leftData.splice(index, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})[0]);
|
});
|
||||||
|
if (filteredData && filteredData.length > 0) this.rightData.push(filteredData[0]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (init) {
|
if (init) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue