Element-UI 展开行table,如何在某些特殊条件下呈现展开行格式

设置type="expand"后每行都有展开按钮,都可展开,
需求是只有某些特殊条件下,这一行才可以展开,其他行没有展开按钮不可展开,如图。
求解决办法。。。。

https://img3.mukewang.com/5c10bf330001f05403200155.jpg

慕容森
浏览 4729回答 1
1回答

繁华开满天机

我找到了一个偏方:用&nbsp;row-class-name&nbsp;给不需要展开的行添加一个类给这个类的所在行的expand这一列设置visibility:hidden样式,大体代码如下:<template>&nbsp; <el-table :data=tabledata :row-class-name="getRowClass">&nbsp; &nbsp; ...&nbsp; </el-table><template><script>// ...methods: {&nbsp; getRowClass: function (row, index) {&nbsp; &nbsp; if(row.canExpand)&nbsp; &nbsp; &nbsp; return ''&nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; return 'hide-expand'&nbsp; }}// ...</script><style>/*.hide-expand{&nbsp; visibility:hidden}*//*CSS 修正*/.hide-expand .el-table__expand-column .el-icon {&nbsp; visibility: hidden;}</style>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript