The elementui table component check box sets whether the row is optional according to the condition

The elementui table component check box sets whether the row is optional according to the condition
HTML part code

<el-table
        ref="multipleTable"
        :data="tableData"
        v-loading="loading"
        tooltip-effect="dark"
         @selection-change="handleSelectionChange">
        <el-table-column v-if="!queryType" type="selection" width="55" :selectable="checkboxInit"/>
        <el-table-column align="center" prop="AA" label="A"></el-table-column>
        <el-table-column align="center" prop="BB" label="B"></el-table-column>
        <el-table-column align="center" prop="CC" label="C"></el-table-column>
      </el-table>

js part of the code, mainly checkboxInit method implementation is optional

methods: {
  //判断复选框是否可选
    checkboxInit(row) {
      if ( 条件判断语句 ) { // 每行数据在该条件下不可选
        return 0 //不可勾选
      } else { // 在该条件下可选
        return 1
      }
    }
}

Guess you like

Origin blog.csdn.net/DarlingYL/article/details/125854177