el-table复选框选中一行之后其他行禁用

el-table复选框选中一行之后其他行禁用

<el-table
          ref="multipleTable"
          :data="mirrorTableData"
          @selection-change="mirrorSelectionChange"
          style="width: 100%">
          <el-table-column
            type="selection"
            :selectable="selectable"
            width="55">
          </el-table-column>
          <el-table-column
            prop="data"
            show-overflow-tooltip
            label="名称">
          </el-table-column>
 </el-table>
 //是否禁用
    selectable(row){
      const selectArr = this.$refs.multipleTable.selection;//获取选中行
      const state = selectArr.some((item) => item.id == row.id);
      return (
        selectArr.length < 1 || state //1:限制选中条数
      );
    }

产品要求表格复选框实现单选效果


版权声明:本文为weixin_45744454原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。