Jelajahi Sumber

fix: 延迟主动加载时间

xyh 2 tahun lalu
induk
melakukan
2576692647
1 mengubah file dengan 9 tambahan dan 0 penghapusan
  1. 9 0
      src/pages/log-list/hooks.js

+ 9 - 0
src/pages/log-list/hooks.js

@@ -1,5 +1,6 @@
 import {getOrderDateList} from '@apis';
 import {useQuery} from '@tanstack/react-query';
+import {useReady} from '@tarojs/taro';
 import dayjs from 'dayjs';
 import {groupBy} from 'lodash-es';
 import {useState} from 'react';
@@ -12,6 +13,13 @@ export function useList() {
       '-' +
       dayjs().daysInMonth().toString().padStart(2, '0'),
   });
+  const [enabled, setEnabled] = useState(false);
+
+  useReady(function () {
+    setTimeout(function () {
+      setEnabled(true);
+    }, 50);
+  });
 
   function onDateChange(start, end) {
     setParams({agoScrq: start, endScrq: end});
@@ -32,6 +40,7 @@ export function useList() {
     },
     placeholderData: [],
     keepPreviousData: true,
+    enabled,
   });
 
   return [