一、如果table中使用了stripe(斑马纹),那么row-class-name就会失效!
二、官网给的例子中的代码
methods: {
tableRowClassName({row, rowIndex}) {
if (rowIndex === 1) {
return ‘warning-row’;
} else if (rowIndex === 3) {
return ‘success-row’;
}
return ‘’;
}
},
tableRowClassName的参数{row, rowIndex}有点坑啊,打个断点就知道,只需要一个就好了,而且对象层级也是有问题的,后来我改成了
tableRowClassName(val) {
if (val.row.status<0) {
return ‘warning-row’;
}
return ‘’;
},
本文探讨了在Vue表格中使用stripe斑马纹会导致row-class-name失效的问题,并分享了解决方案,重点在于tableRowClassName方法的优化和参数理解。
5423

被折叠的 条评论
为什么被折叠?



