This commit is contained in:
zhangkai
2024-07-02 16:14:12 +08:00
parent 8b8f4111e2
commit a7677c32fb
37 changed files with 592 additions and 240 deletions

View File

@@ -71,7 +71,7 @@ export function useTable<T extends object>(param, apiFun) {
const requestIdRef = useRef(0); // 控制请求响应顺序
const loadData = () => {
setLoading(true);
// setLoading(true);
const requestId = ++requestIdRef.current
apiFun({ ...page, ...paramRef.current }).then(res => {
if (requestId !== requestIdRef.current) return
@@ -79,9 +79,9 @@ export function useTable<T extends object>(param, apiFun) {
// res.data.unshift({type:0})
setData(res.data);
setTotal(res.total);
setLoading(false);
// setLoading(false);
}).catch(() => {
setLoading(false);
// setLoading(false);
})
}
const debounceLoad = useDebounce(loadData, 600, false)