其他分享
首页 > 其他分享> > 数组上下移动

数组上下移动

作者:互联网

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);
},

标签:index,arr,index1,dataList,newArray,数组,上下,移动,swapItems
来源: https://www.cnblogs.com/niluiquhz/p/12145364.html