数组上下移动

swapItems(arr, index1, index2) {
    arr[index1] = arr.splice(index2, 1, arr[index1])[0];
    return arr;
},
upStep(index) {
   const newArray = this.swapItems(this.paramTbObj.dataList, index, index - 1);
},
downStep(index) {
   const newArray = this.swapItems(this.paramTbObj.dataList, index, index + 1);
},
posted @ 2020-01-03 15:56  可乐雪碧芬达  阅读(278)  评论(0编辑  收藏  举报