情景:例如考核列表,查询某一年分的考核列表,根据id的存在判断是否考核过,如果考核过,前面的勾选框不能勾选;

 

 vue中使用elementui里的table时,需求是前面的勾选框根据条件判断是否可以勾选设置

 

 

 

 

  直接粘贴代码:

  <el-table-column type="selection" width="55" :selectable='checkboxInit'>
methods里
  
    //判断是否可选
    checkboxInit(row, index) {
      console.log("判断是否可选");
      console.log(row, index);
      if (row.id) {
        return 0; //不可勾选
      } else {
        return 1;
      }
    },
 
结束

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-09-03
  • 2022-03-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-05-09
相关资源
相似解决方案