第一种:在el-table
中加上 header-cell-style
和cell-style
样式
<el-table :data="list"
:header-cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }"
></el-table>
第二种:在style
中加上 CSS样式
<style lang="scss" scoped>
::v-deep .el-table th > .cell {
text-align: center;
}
::v-deep .el-table .cell {
text-align: center;
}
</style>