zoukankan      html  css  js  c++  java
  • 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)"
  • 相关阅读:
    PHP常量
    jquery中的几种常用总结
    jquery中的ajax
    常用的jquery一些总结
    js验证手机号邮箱号用户名
    PHP优化杂烩
    一个php开发的用于路由器的小功能
    HTML <form>
    window.open
    try&catch
  • 原文地址:https://www.cnblogs.com/qjh0208/p/13846853.html
Copyright © 2011-2022 走看看