| | |
| | | const tableNode = ref(null); |
| | | const scrollHeight = ref(null); |
| | | const scrollTop = ref(null); |
| | | |
| | | const isBind = ref(false); |
| | | let scrollTimer = null; |
| | | |
| | | // 滚动 |
| | |
| | | )[0]; |
| | | scrollHeight.value = tableNode.value.scrollHeight; |
| | | scrollTop.value = tableNode.value.scrollTop; |
| | | |
| | | bindWheel(tableNode.value); |
| | | scrollTimer = setInterval(() => { |
| | | scrollTableOne.value.setScrollTop(scrollTop.value++); |
| | | |
| | | |
| | | if (scrollTop.value >= scrollHeight.value - tableNode.value.offsetHeight) { |
| | | scrollTop.value = 0; |
| | | scrollTableOne.value.setScrollTop(0); |
| | |
| | | }, 50); |
| | | }; |
| | | |
| | | const bindWheel = (dom) => { |
| | | if (isBind.value) return; |
| | | isBind.value = true; |
| | | dom.addEventListener("mousewheel", () => { |
| | | clearScroll(); |
| | | debounce(() => { |
| | | scrollTable(); |
| | | }, 300) |
| | | }) |
| | | } |
| | | |
| | | |
| | | const clearScroll = (() => { |
| | | clearInterval(scrollTimer); |
| | | }); |
| | | |
| | | // 防抖函数 |
| | | let timeout; |
| | | function debounce(func, delay) { |
| | | clearTimeout(timeout); |
| | | timeout = setTimeout(func, delay); |
| | | } |
| | | |
| | | watch(tableState, (newVal) => { |
| | | if (newVal) { |
| | |
| | | overflow: hidden; |
| | | } |
| | | |
| | | ::v-deep .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell { |
| | | background-color: unset; |
| | | } |
| | | |
| | | ::v-deep .el-scrollbar__bar.is-vertical { |
| | | display: none !important; |
| | | } |
| | | // .head-table { |
| | | // &:deep(.el-table__body-wrapper) { |
| | | // display: none; |
| | |
| | | // :deep(.el-table__header-wrapper) { |
| | | // display: none; |
| | | // } |
| | | // }</style> |
| | | // } |
| | | </style> |