Element UI中el-table组件type=selection时CheckBox禁止选择

在列表中有删除需求时,如果数据状态没有达到可以删除的状态时可以选择禁止复选框来达到需求

表格样例

<el-table v-loading="loading" :data="tableData" ref="multipleTable" @selection-change="handleSelectionChange">
    <el-table-column type="selection" width="55" align="center" :selectable="selectFn"></el-table-column>
</el-table>

逻辑判断

handleSelectionChange(selection) {
   this.ids = selection
   this.single = selection.length != 1
   this.multiple = !selection.length
},
selectFn(row, index) {
   if (row.status != 2) {
      return true
   } else {
      return false
   }
},

你可能感兴趣的:(vue.js,前端,javascript)