el-table实现根据条件对特定的table-cloumn进行是否可勾选

el-table实现根据条件对特定的table-column进行是否可勾选
<el-table-column
type="selecttion"
label="全选"
:selectable="selectable"
>
</el-table-column>
 
methods:{
selectable(row,index){
    if(row.status== 5){
        return false
    }else{
        return true
    }
}
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
在Element UI的el-table-column中添加数据,可以通过以下几种方式实现: 1. 使用prop属性:通过设置prop属性,将数据与表格列进行绑定。prop属性指定了表格数据对象中的字段名,可以直接显示该字段的值。 例如: ```html <el-table :data="tableData"> <el-table-column prop="name" label="姓名"></el-table-column> <el-table-column prop="age" label="年龄"></el-table-column> </el-table> ``` 在上述代码中,tableData是一个数组,每个元素都包含了name和age字段。el-table-column的prop属性分别与name和age字段进行绑定,实现了数据的显示。 2. 使用slot-scope:通过slot-scope可以获取到当前行的数据对象,可以在slot-scope中自定义显示内容。 例如: ```html <el-table :data="tableData"> <el-table-column label="姓名"> <template slot-scope="scope">{{ scope.row.name }}</template> </el-table-column> <el-table-column label="年龄"> <template slot-scope="scope">{{ scope.row.age }}</template> </el-table-column> </el-table> ``` 在上述代码中,通过slot-scope获取到当前行的数据对象,并通过scope.row.name和scope.row.age获取到name和age字段的值。 3. 使用自定义组件:可以通过自定义组件的方式来添加数据。在自定义组件中,可以根据需要展示不同的数据。 例如: ```html <el-table :data="tableData"> <el-table-column label="姓名"> <template slot-scope="scope"> <custom-component :data="scope.row.name"></custom-component> </template> </el-table-column> <el-table-column label="年龄"> <template slot-scope="scope"> <custom-component :data="scope.row.age"></custom-component> </template> </el-table-column> </el-table> ``` 在上述代码中,通过自定义组件custom-component来展示数据,将当前行的name和age字段传递给自定义组件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Y2000104

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值