在vue中使用el-table但是行间距利用padding或者margin不起作用,是因为display使用的是table属性,所以我们要利用table特性来进行处理。
代码如下:
.el-table {
width: 100%;
margin-bottom: 20px;
&::before {
display: none;
}
.el-table__body {
//-webkit-border-horizontal-spacing: 13px; // 水平间距
-webkit-border-vertical-spacing: 10px; // 垂直间距 设置的是行间距
}
//以下代码是实现边框效果
thead th {
font-size: 14px;
color: #575757;
&:nth-last-child(2) {
border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
border-radius: 0 5px 5px 0;
right: 1px;
}
}
thead th,
.el-table__row td {
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
padding: 10px 0;
border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
&:first-child {
border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
border-radius: 5px 0 0 5px;
}
}
.el-table__row > td {
font-size: 12px;
color: #333333;
&:last-child {
border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
border-radius: 0 5px 5px 0;
right: 1px;
}
}
.el-table__body tr:hover > td.el-table__cell {
background-color: rgba(0, 110, 255, 0.05);
}
.el-table__fixed::before {
display: none;
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
实现效果:


评论记录:
回复评论: