<el-table :data="tableData" style="width: 100%" :row-class-name="tableRowClassName">
el-table添加row-class-name绑定tableRowClassName
在table数据不是tree数据时,rowIndex拿到的是table行的索引
tableRowClassName({ row,rowIndex }) {
if (rowIndex % 2 === 0) {
return "";
} else {
return "rowStyle"
}
},
<style lang="less">
.el-table .rowStyle {
background-color: #F8F8F8;
}
</style>
在table数据是tree数据结构时:
<el-table
ref="multipleTable"
:data="classifyData"
row-key="id"
default-expand-all
:tree-props="{ children: 'chlidList', hasChildren: 'hasChildren' }"
tooltip-effect="