el-table设置表头颜色
要设置el-table的表头颜色,可以使用header-cell-style属性来指定表头单元格的样式。具体步骤如下:
- 在
el-table组件中设置header-cell-style属性,并将其值设置为一个对象。 - 在对象中,使用
background-color属性来设置表头的背景颜色。
示例代码如下:
<el-table :data="tableData">
<el-table-column prop="name" label="姓名" :header-cell-style="{ backgroundColor: 'red' }"></el-table-column>
<el-table-column prop="age" label="年龄" :header-cell-style="{ backgroundColor: 'blue' }"></el-table-column>
</el-table>
在上面的示例中,表头单元格的背景颜色分别被设置为红色和蓝色。你可以根据需要修改background-color的值来改变表头的颜色
原文地址: https://www.cveoy.top/t/topic/hJK9 著作权归作者所有。请勿转载和采集!