el-table 表格组件想要修改表头,可以使用 header-row-class-name 和 header-cell-class-name两种方式(仅个人习惯使用的两种方式)
第一种:header-cell-class-name(个人更倾向这种方式,写起来也更舒服)
首先,添加header-cell-class-name="table_header"
属性,
其次:添加指定的table_header
样式,这里需要注意,需要使用/deep/ 或者 ::v-deep(视预编译语言而定)来指定样式,否则渲染不到。
第二种:header-row-class-name
首先,添加header-row-class-name:table_header_class
属性,
其次,设置table_header_class
样式。这里需要注意,需要使用/deep/
或者 ::v-deep
(视预编译语言而定)来指定样式,否则渲染不到,打开F12可以看到,需要变更的颜色,实则为th标签
最终table表头渲染效果如图: