refactor: 集中管理配置常量并优化样式一致性

This commit is contained in:
zhang1106
2026-03-06 14:39:52 +08:00
parent 0cd0107008
commit 885ac47fd2
19 changed files with 348 additions and 64 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react';
import { API_CONFIG } from '../config/api';
/**
* 防抖 Hook
@@ -15,7 +16,7 @@ import { useState, useEffect } from 'react';
* fetchData(debouncedKeyword);
* }, [debouncedKeyword]);
*/
export function useDebounce(value, delay = 300) {
export function useDebounce(value, delay = API_CONFIG.debounceDelay) {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
@@ -44,7 +45,7 @@ export function useDebounce(value, delay = 300) {
*
* <Input onChange={e => debouncedSearch(e.target.value)} />
*/
export function useDebouncedCallback(callback, delay = 300) {
export function useDebouncedCallback(callback, delay = API_CONFIG.debounceDelay) {
const [timeoutId, setTimeoutId] = useState(null);
const debouncedFn = (...args) => {