lanjianrong 5 gadi atpakaļ
vecāks
revīzija
6a19d65a45

+ 6 - 4
src/pages/Customer/Contact/components/CustomerModal/index.jsx

@@ -18,7 +18,7 @@ const SearchModal = ({ clientId, onSelect }) => {
     customer: [],
     searchVal: '',
     current: 1,
-    pageSize: 10,
+    pageSize: 7,
     total: 0
   })
   const initData = async params => {
@@ -34,14 +34,14 @@ const SearchModal = ({ clientId, onSelect }) => {
           customer: state.customer.concat(customer),
           total,
           laoding: false,
-          pageSize: params?.pageSize || 1
+          current: params?.current || 1
         })
       }
     }
   }
 
   useEffect(() => {
-    initData({ current: 1, pageSize: 10 })
+    initData({ current: 1, pageSize: 7 })
   }, [])
   const onChange = e => {
     const { value = '' } = e.target || e.currentTarget
@@ -86,7 +86,9 @@ const SearchModal = ({ clientId, onSelect }) => {
       scrollRef.current.scrollTop
     ) {
       // 已到底部
-      initData({ current: state.current + 1, pageSize: state.pageSize })
+
+      state.current * state.pageSize < state.total &&
+        initData({ current: state.current + 1, pageSize: state.pageSize })
     }
   }
   // const { run: listScroller } = useThrottleFn(handleListScroll)