瀏覽代碼

fix: 延迟主动加载时间

xyh 2 年之前
父節點
當前提交
2576692647
共有 1 個文件被更改,包括 9 次插入0 次删除
  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 [