Commit 8b73f45bf772c7abee1d3096dab04849e5b6d6b3
Committed by
GitHub
Merge pull request #1167 from lcx960324/2.0
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) { | ... | ... |