Element el-table 上移 下移

 1  //向上移动
 2   moveUp(index,row) {
 3       var that = this;
 4       console.log('上移',index,row);
 5       console.log(that.imageData[index]);
 6       if (index > 0) {
 7           let upDate = that.imageData[index - 1];
 8           that.imageData.splice(index - 1, 1);
 9           that.imageData.splice(index,0, upDate);
10       } else {
11         alert('已经是第一条,不可上移');
12       }
13   },
14 //向下移动
15 moveDown(index,row){
16    var that = this;
17   console.log('下移',index,row);
18   if ((index + 1) === that.imageData.length){
19     alert('已经是最后一条,不可下移');
20   } else {
21     console.log(index);
22     let downDate = that.imageData[index + 1];
23     that.imageData.splice(index + 1, 1);
24     that.imageData.splice(index,0, downDate);
25   }
26 },
@click="moveDown(scope.$index,scope.row)"
@click="moveUp(scope.$index,scope.row)"
原文地址:https://www.cnblogs.com/qjh0208/p/13846853.html