elementUI表格行高无法过低设置,根本原因在于有一个<div class= 'cell'></div>限制了大小,我的版本中最小lineheight为40,多次尝试使用接口与自定义样式无效,直接更改源码
找到node_modules\element-ui\teaStyle\theme\index.css
过滤“.el-table .cell”选择器
直接删掉lineheight属性,便会自动撑开高度
修改后应如下
.el-table .cell {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
word-break: break-all;
padding-left: 10px;
padding-right: 10px
}
如果有其他格式需求可以在row-syule和cell-style表格属性中更改