table勾选

           <el-table
            :data="tableData"
            @sort-change="handlesortChange"
            @select="
              (selection, row) => {
                cleckedData(selection, row);
              }
            "
            highlight-current-row
            v-loading="loading"
            :header-cell-style="{
              textAlign: 'left',
              color: '#222',
              'font-family': 'Microsoft YaHei',
              'font-size': '13px',
              'font-weight': '400',
              background: '#E1E3F0',
            }"
            :cell-style="{ fontSize: '13px', color: '#333' }"
            style="width: 100%"
          >


     data部分:

     data(){
       cleckedDatas: [],
     }

    js部分:

    cleckedData(selection, row) {
      if (this.cleckedDatas.includes(row)) {
        this.cleckedDatas.splice(this.cleckedDatas.indexOf(row), 1);
      } else {
        this.cleckedDatas.push(row);
      }
      console.log(this.cleckedDatas);
    },

上一篇:el-table toggleRowSelection被动触发select/selection-change事件的解决方案


下一篇:【revit二次开发】一些简单的API