代码:
updated(){
// 表格斑马行显示
this.renderStripe()
},
methods: {
// 表格斑马行显示
renderStripe(){
const table=document.getElementsByClassName('ant-table-row')
if(table.length>0){
const rowList=[...table]
rowList.map((row,index)=>{
if(index%2 !== 0) {
row.style.backgroundColor = '#f9f9f9'
} else {
row.style.backgroundColor = '#ffffff'
}
})
}
},
}