elemenui点击单行触发样式,选中或不选中复选框

1.在 el-table 部分加上 @row-click 和 ref

<el-table
           ref="handSelectTest_multipleTable"
           tooltip-effect="dark"
           :data="tableData"
           style="width:100%"
           height="500"
           @selection-change="handleSelectionChange"
           @row-click="handleRowClick"
           v-loading="loading"
           >

2.编写触发方法

  //点击复选框触发,复选框样式的改变
    handleSelectionChange(val) {
        this.multipleSelection = val;
    },
    //点击行触发,选中或不选中复选框
       handleRowClick(row, column, event) {
        this.$refs.handSelectTest_multipleTable.toggleRowSelection(row);
        // console.log("this.selecTestContent", this.selectTestContent);
    },

 

posted @ 2020-07-15 09:59  ljygirl  阅读(306)  评论(0编辑  收藏  举报