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)
          }
        }
      }
    }
  • 相关阅读:
    下载文件
    全局处理程序
    缩略图
    图片
    文件上传
    application用法
    多分辨率的支持
    适用于cocos2dx的编辑器:Texture,Tilemap,Particle,Action,Level etc
    cocos2dx下最大纹理大小取决于平台
    CCLabelTTF 如何支持换行符和换行
  • 原文地址:https://www.cnblogs.com/mark21/p/13539176.html
Copyright © 2011-2022 走看看