<div class="user_skills">
<el-table :header-cell-style="{background:'transparent', fontSize: '30px',color:'#FFFFFF'}"
:data="dataList"
:cell-class-name="getCellClass" :cell-style="cellStyle"
:max-height="250"
ref="scroll_Table"
@mouseenter.native="autoScroll(true)"
@mouseleave.native="autoScroll(false)"
:row-style="{height:'60px'}"
style="font-size: 36px;font-weight: 600"
>
<el-table-column prop="directive" label="指令单"></el-table-column>
</el-table>
</div>
// 设置自动滚动
autoScroll(stop) {
const table = this.$refs.scroll_Table
// 拿到表格中承载数据的div元素
const divData = table.$refs.bodyWrapper
// 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
if (stop) {
//再通过事件监听,监听到 组件销毁 后,再执行关闭计时器。
window.clearInterval(this.scrolltimer)
} else {
this.scrolltimer = window.setInterval(() => {
// 元素自增距离顶部1像素
divData.scrollTop += 1
// 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
if (divData.clientHeight + divData.scrollTop == divData.scrollHeight) {
// 重置table距离顶部距离
divData.scrollTop = 0
// 重置table距离顶部距离。值=(滚动到底部时,距离顶部的大小) - 整个高度/2
// divData.scrollTop = divData.scrollTop - divData.scrollHeight / 2
}
}, 150) // 滚动速度
}
}
.user_skills {
width: 1686px;
height: 320px;
// 设置表头字体粗细
::v-deep .el-table th .cell {
font-weight: normal
}
::v-deep .white-text {
color: #ffffff;
}
::v-deep .red-text {
color: red;
}
::v-deep .el-table, .el-table__expanded-cell {
background-color: transparent; // 表格背景透明
}
::v-deep .el-table::before {
height: 0px; // 去除表格底部白线
}
//去除表格每一行的下标线;
::v-deep .el-table td {
border-bottom: none;
}
//去除表头的下标线;
::v-deep .el-table th.is-leaf {
border-bottom: none;
}
::v-deep .el-table__body tr:hover > td {
background-color: transparent !important;
}
::v-deep .el-table tr {
background-color: transparent !important;
}
::v-deep .el-table--enable-row-transition .el-table__body td, .el-table .cell {
background-color: transparent;
}
::v-deep .el-table .cell {
line-height: 36px
}
// 隐藏滚动条
::v-deep .el-table__body-wrapper::-webkit-scrollbar{
/*width: 0;宽度为0隐藏*/
width: 0px;
}
::v-deep .el-table th.gutter{
display: none;
width:0
}
::v-deep .el-table colgroup col[name='gutter']{
display: none;
width: 0;
}
::v-deep .el-table__body{
width: 100% !important;
}
}