Commit 8b73f45bf772c7abee1d3096dab04849e5b6d6b3

Authored by Aresn
Committed by GitHub
2 parents a358e0c7 11748ba5

Merge pull request #1167 from lcx960324/2.0

bugfix on transfer
examples/routers/transfer.vue
@@ -164,7 +164,7 @@ @@ -164,7 +164,7 @@
164 export default { 164 export default {
165 data () { 165 data () {
166 return { 166 return {
167 - data1: this.getMockData(), 167 + data1: [] || this.getMockData(),
168 targetKeys1: this.getTargetKeys() 168 targetKeys1: this.getTargetKeys()
169 } 169 }
170 }, 170 },
src/components/transfer/transfer.vue
@@ -194,14 +194,14 @@ @@ -194,14 +194,14 @@
194 this.rightData = []; 194 this.rightData = [];
195 if (this.targetKeys.length > 0) { 195 if (this.targetKeys.length > 0) {
196 this.targetKeys.forEach((targetKey) => { 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 if (init) { 207 if (init) {