项目场景:
项目场景:项目组需要去除默认的elemnet-ui的table组件的默认样式:去除默认背景色,去除下划线等等
问题描述
(1)如何去除表格中表头的默认背景色
(2)如何去除表格中表格的单元格下划线
想要的效果图如下(还需要去除下划线)
原因分析:
公司封装的表头默认设置了颜色,也默认设置了下划线
解决方案:
提示:最简单的方式,使用css样式覆盖
/* 去除表格默认背景和线条 */
:deep(.el-table th){
/* 背景透明色 */
background-color: transparent;
border-top: none;
border-bottom: none;
}
:deep(.el-table td, .el-table th.is-leaf, .el-table--border th.gutter:last-of-type){
border-bottom: none;
}
:deep(.el-table::before){
height: 0;
}
效果图:
提示:右边两列我设置了超链接,与本文无关