el-table关于选择行的三个常用事件

发布时间 2023-09-11 13:46:47作者: lybingyu

变量声明

data(){
  return{
    selectList: [],
  }
}

 

事件绑定

<el-table @select-all="selectAllChange" @selection-change="secondaryPageTableSelectStorage"

方法函数实现

        // 表格数据全选
        selectAllChange: function (row) {
            this.selectList = row;
        },
        // 表格数据多选
        secondaryPageTableSelectStorage: function (row) {
            this.selectList = row;
        },

另外:事件@current-change="handleCurrentChange" 可以使用单选行变化时触发获取当前行选中行

handleCurrentChange(val) { this.currentRow = val; }