startTableScroll() {
// 获取表格滚动容器
const tableWrapper = this.$refs.tableRef.$el.querySelector('.el-table__body-wrapper');
if (tableWrapper) {
this.scrollInterval = setInterval(() => {
// 每次滚动 1 像素
tableWrapper.scrollTop += 1;
// 判断是否滚动到底部
if (tableWrapper.scrollTop >= tableWrapper.scrollHeight - tableWrapper.clientHeight) {
// 滚动到底部后重置滚动位置到顶部
tableWrapper.scrollTop = 0;
}
}, 30); // 每 30 毫秒滚动一次
}
},
stopTableScroll() {
if (this.scrollInterval) {
clearInterval(this.scrollInterval);
this.scrollInterval = null;
}
},
resetTableScroll() {
// 重置表格滚动位置到顶部
const tableWrapper = this.$refs.tableRef.$el.querySelector('.el-table__body-wrapper');
if (tableWrapper) {
tableWrapper.scrollTop = 0;
}
}
::v-deep.el-table__body-wrapper::-webkit-scrollbar {
width: 0 !important;
}
::v-deep .el-table__body-wrapper {
scrollbar-width: none;
-ms-overflow-style: none;
} 去掉bar