liuQiang 1 жил өмнө
parent
commit
86d68f3f87

+ 12 - 5
src/views/search/index.vue

@@ -160,7 +160,7 @@ const copyFileType = ref()
 const reload = inject("reload");
 const addFileTab = inject("addFileTab");
 const clickPath = inject("clickPath");
-
+const canSceoll = ref(true)
 const tableData = ref([]);
 // 切换搜索范围
 const changeSearchFor = async(name) => {
@@ -400,13 +400,15 @@ function formatFileSize(fileSize) {
 let numnum = 1
 let numG = 1
 async function handleScroll(e) {
-  console.log(e, '出发了');
+  // console.log(e, '出发了');
   const tableContainer = e.target;
+  if(!canSceoll.value) return
   const scrollPosition = tableContainer.scrollTop + tableContainer.clientHeight;
   const contentHeight = tableContainer.scrollHeight;
-  // console.log(scrollPosition, contentHeight, '对比');
-  if (scrollPosition + 0.40005 >= contentHeight) {
-    console.log('到底了');
+  console.log(scrollPosition, contentHeight, '对比');
+  if (scrollPosition + 150.0005 >= contentHeight) {
+    // console.log('到底了');
+    canSceoll.value = false
     numnum++
     const query = {
       keyword: searchText.value,
@@ -418,6 +420,11 @@ async function handleScroll(e) {
     };
     const res = await flieSearch(query);
     tableData.value = [...tableData.value, ...res.rows]
+    if(tableData.value.length<total.value){
+      setTimeout(() => {
+        canSceoll.value = true
+      }, 1000);
+    }
   }
 }
 async function handleScrollG(e) {