zoukankan      html  css  js  c++  java
  • elementUI table怎么实现点击上移下移

    其实炒鸡简单。。。

     

    <el-table :data='tableData' >
    ...
    ...
     <el-table-column label="操作" align="center" width="140" >
             <template slot-scope="scope">
                  <el-button type="text" @click="upMove(scope.$index,scope.row)">上移</el-button>
                  <el-button type="text" @click="upDown(scope.$index,scope.row)">下移</el-button>
              </template>
    </el-table-column>
    </el-table>
     
    export default{
      methods:{   
        upMove(index, row) {
          if (index <= 0) {
            this.$message.error('不能继续向上移动')
          } else {
            const upData = this.tableData[index - 1]
            this.tableData.splice(index - 1, 1)
            this.tableData.splice(index, 0, upData)
          }
        },
        upDown(index, scope) {
          if (index === (this.tableData.length - 1)) {
            this.$message.error('不能继续向下移动')
          } else {
            const downData = this.tableData[index + 1]
            this.tableData.splice(index + 1, 1)
            this.tableData.splice(index, 0, downData)
          }
        }
      }
    }
  • 相关阅读:
    在linux上使用Android systrace
    perf性能调优
    未初始化内存检测(MSan)
    数据竞争检查工具(TSan)
    应用层内存溢出/越界/重复释放等问题检查工具(ASan)
    gperf heap profiler
    cmake打印shell
    github clone加速
    获取一个进程的所有物理地址上的内存
    Jenkins <1>: System Management
  • 原文地址:https://www.cnblogs.com/mark21/p/13539176.html
Copyright © 2011-2022 走看看