給你的 el-table 加上倆個屬性 cell-style header-cell-style
<el-table :cell-style="cellStyle" :header-cell-style="rowClass">
</el-table>
// 然後就是在方法中定義兩個方法
methods:{
private cellStyle({row,column,rowIndex,columnIndex}:any){
return "text-align:center;"
}
private rowClass({row,rowIndex}:any){
return "text-align:center;"
}
}
刷新頁面就可以了