张延森 3 år sedan
förälder
incheckning
a7cfde6598
1 ändrade filer med 1 tillägg och 3 borttagningar
  1. 1
    3
      src/components/List/index.jsx

+ 1
- 3
src/components/List/index.jsx Visa fil

3
 
3
 
4
 import { ScrollView } from '@tarojs/components';
4
 import { ScrollView } from '@tarojs/components';
5
 import Taro from '@tarojs/taro';
5
 import Taro from '@tarojs/taro';
6
-import usePrevious from '@/utils/hooks/usePrevious';
7
 
6
 
8
 export default React.forwardRef((props, ref) => {
7
 export default React.forwardRef((props, ref) => {
9
   const {
8
   const {
24
   const [list, setList] = useState([])
23
   const [list, setList] = useState([])
25
   const pageRef = useRef({ current: 1 })
24
   const pageRef = useRef({ current: 1 })
26
   const [hasMore, setHasMore] = useState(false)
25
   const [hasMore, setHasMore] = useState(false)
27
-  const preParams = usePrevious(params)
28
 
26
 
29
   // 滚动
27
   // 滚动
30
   const handleScrollToLower = (e) => {
28
   const handleScrollToLower = (e) => {
49
       setHasMore(pageInfo.current < pageInfo.pages)
47
       setHasMore(pageInfo.current < pageInfo.pages)
50
 
48
 
51
       if (onDataChange) {
49
       if (onDataChange) {
52
-        onDataChange(lst, { paramsChanged: preParams !== params })
50
+        onDataChange(lst, { paramsChanged: pageInfo.current === 1 })
53
       }
51
       }
54
 
52
 
55
       pageRef.current = pageInfo
53
       pageRef.current = pageInfo