From 85441ede2c0d323cf69d771e16141550333abb7a Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期五, 08 三月 2024 15:41:59 +0800
Subject: [PATCH] fix:修改滚动table

---
 src/views/daoAnOffice/right/danger/dataTable.vue |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/views/daoAnOffice/right/danger/dataTable.vue b/src/views/daoAnOffice/right/danger/dataTable.vue
index 41c51d6..1a9a2df 100644
--- a/src/views/daoAnOffice/right/danger/dataTable.vue
+++ b/src/views/daoAnOffice/right/danger/dataTable.vue
@@ -159,7 +159,7 @@
 const tableNode = ref(null);
 const scrollHeight = ref(null);
 const scrollTop = ref(null);
-
+const isBind = ref(false);
 let scrollTimer = null;
 
 // 婊氬姩
@@ -170,11 +170,9 @@
   )[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);
@@ -182,10 +180,28 @@
   }, 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) {
@@ -291,6 +307,13 @@
   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;
@@ -301,4 +324,5 @@
 //   :deep(.el-table__header-wrapper) {
 //     display: none;
 //   }
-// }</style>
\ No newline at end of file
+// }
+</style>
\ No newline at end of file

--
Gitblit v1.8.0