vue element UI 表格的多选框 如何根据条件隐藏显示(如图)

https://img2.mukewang.com/5c85bf6c0001e6f408000402.jpg

https://img2.mukewang.com/5c85bf6c00019faf06580656.jpg

当年话下
浏览 17436回答 2
2回答

哔哔one

提供一个方法,通过添加相应类来控制样式,设置 display: none ,达到隐藏 checkbox 的目的。利用Table Attributes 属性里面的 cell-class-name 属性,添加单元格的class&nbsp;<template>&nbsp; &nbsp; <el-table&nbsp; &nbsp; &nbsp;:cell-class-name="cellcb"&nbsp; &nbsp; &nbsp;...&nbsp; &nbsp; >&nbsp; &nbsp; &nbsp;</el-table>&nbsp; &nbsp;&nbsp;</template><script>&nbsp; methods: {&nbsp; &nbsp; cellcb(row){&nbsp; &nbsp; &nbsp; if(row.row.checkStatus === 1&&row.columnIndex === 0){&nbsp; &nbsp; &nbsp; &nbsp; return "myCell"&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }&nbsp;&nbsp;</script><style>&nbsp;.myCell .el-checkbox__input {&nbsp; display: none}&nbsp; &nbsp;</style>

红颜莎娜

//状态为1时不显示复选框&nbsp; &nbsp; 试试这样&nbsp;<el-table-column type="selection" width="45" v-if="checkStatus != 1"></el-table-column>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript