lanjianrong 4 лет назад
Родитель
Сommit
fe3d3e9899
1 измененных файлов с 4 добавлено и 10 удалено
  1. 4 10
      src/pages/Hr/Notification/index.jsx

+ 4 - 10
src/pages/Hr/Notification/index.jsx

@@ -12,7 +12,7 @@ const Notification = () => {
   const [state, setState] = useState({
   const [state, setState] = useState({
     loading: false,
     loading: false,
     message: [],
     message: [],
-    hasMore: true,
+    hasMore: false,
     current: 1,
     current: 1,
     pageSize: 10,
     pageSize: 10,
     total: 0
     total: 0
@@ -29,22 +29,16 @@ const Notification = () => {
         message: state.message.concat(message),
         message: state.message.concat(message),
         total,
         total,
         loading: false,
         loading: false,
+        hasMore: total > params.current * state.pageSize,
         current: params?.current || 1
         current: params?.current || 1
       })
       })
     }
     }
   }
   }
   useEffect(() => {
   useEffect(() => {
-    initData({ current: 1, pageSize: 10 })
+    initData({ current: 1 })
   }, [])
   }, [])
   const loadMoreData = () => {
   const loadMoreData = () => {
-    if (state.total === state.message?.length) {
-      return
-    }
-    setState({
-      loading: true,
-      current: state.current + 1,
-      pageSize: state.pageSize
-    })
+    initData({ current: state.current + 1 })
   }
   }
   return (
   return (
     <div className="bg-hex-ffffff rounded-md px-6 pb-6">
     <div className="bg-hex-ffffff rounded-md px-6 pb-6">