当前位置:   article > 正文

element的表格设置及滚动条的设置_element表格设置滚动条

element表格设置滚动条

element的Table 表格

1.通过使用elementUI中的表格,达到我们需要的效果,其中包括对滚动条的修改,以及文字颜色修改等…
2.先看效果,是可以滚动的
在这里插入图片描述
HTML

<div class="content_table">
	<el-table :data="tableData" border style="width: 100%;background-color:rgba(15, 47, 89, 0.5)" :header-cell-style="{color: '#fff',  background: '#071c3c' , border: '1px solid #5c5f6d'}" :row-class-name="tableClass">
		<!--:header-cell-style 对表头的设置-->
		<el-table-column prop="date" label="日期" align="center"></el-table-column>
		<el-table-column prop="name" label="姓名" align="center" ></el-table-column>
		<el-table-column prop="address" label="地址" align="center"></el-table-column>
	</el-table>
 </div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

js代码

tableClass({row}){
	if(row.name=='小'){
		return 'red'
	}else if(row.name=='王'){
		return 'orange'
	}else{
		return ''
	}
},
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

css样式,包括对表格滚动条的样式的修改

/* 表格外部的大小 */
.content_table {
  width: 95%;
  height: 75%;
  margin: 0 auto;
  position: relative;
  top: 20%;
  overflow-y: auto;
}
/* 对表格背景的修改 */
.content_table /deep/ .el-table,
.el-table__expanded-cell {
  background-color: transparent;
}
.content_table /deep/ .el-table tr {
  background-color: transparent !important;
}
.content_table /deep/ .el-table--enable-row-transition .el-table__body td,
.el-table .cell {
  background-color: transparent;
}
/* 对线条的修改 */
.content_table /deep/ .el-table__row > td {
  border: 1px solid #5c5f6d;
}
/* 清除底部横线 */
.el-table::before {
  height: 0px;
}
/* hover到表格的颜色修改 */
.el-table >>> tbody tr:hover > td {
  background-color: rgba(15, 47, 89, 1) !important;
  color: #000;
}
/* 滚动条的样式 */
::-webkit-scrollbar {
  /* 纵向滚动条的宽度 */
  width: 1px;
  /* 横向滚动条的宽度 */
  /* height: 3px; */
}
/* 滚动滑块的颜色 */
::-webkit-scrollbar-thumb {
  background-color: #49b1f5;
  border-radius: 32px;
  -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
}
/* 滚动条背景颜色 */
::-webkit-scrollbar-track {
  background-color: #ececec;
  border-radius: 32px;
}
/* 对表格中的文字颜色进行提前设置 */
/deep/ .el-table .red{
  color:red !important;
}
/deep/ .el-table .orange{
  color: orange !important;
}
  • 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
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59

如不理解,看看风景,再看一遍…
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/850876
推荐阅读
相关标签
  

闽ICP备14008679号