Commit 778e921440f0fa7f1b9b3dfa980806b61480940b
1 parent
4156eef8
bugfix on transfer
Showing
2 changed files
with
9 additions
and
9 deletions
Show diff stats
examples/routers/transfer.vue
src/components/transfer/transfer.vue
... | ... | @@ -194,14 +194,14 @@ |
194 | 194 | this.rightData = []; |
195 | 195 | if (this.targetKeys.length > 0) { |
196 | 196 | this.targetKeys.forEach((targetKey) => { |
197 | - this.rightData.push( | |
198 | - this.leftData.filter((data, index) => { | |
199 | - if (data.key === targetKey) { | |
200 | - this.leftData.splice(index, 1); | |
201 | - return true; | |
202 | - } | |
203 | - return false; | |
204 | - })[0]); | |
197 | + const filteredData = this.leftData.filter((data, index) => { | |
198 | + if (data.key === targetKey) { | |
199 | + this.leftData.splice(index, 1); | |
200 | + return true; | |
201 | + } | |
202 | + return false; | |
203 | + }) | |
204 | + if (filteredData && filteredData.length > 0) this.rightData.push(filteredData[0]) | |
205 | 205 | }); |
206 | 206 | } |
207 | 207 | if (init) { | ... | ... |