fix: 优化watch 修改编辑用户弹窗样式

This commit is contained in:
ZhuRui
2026-07-27 09:51:30 +08:00
parent 17d5c85904
commit e3e66ec03b
11 changed files with 146 additions and 161 deletions
+6 -3
View File
@@ -1,6 +1,7 @@
// src/hooks/useDebounce.ts
import { watch, onUnmounted, Ref } from 'vue';
import { onUnmounted, Ref } from 'vue';
import { useState } from './useState';
import { useEffect } from './useEffect';
export interface UseDebounceOptions {
delay?: number;
@@ -40,7 +41,7 @@ export function useDebounce<T>(source: Ref<T>, options: number | UseDebounceOpti
isFirstCall = true;
};
watch(source, () => {
useEffect(() => {
setIsPending(true);
// 处理 maxWait
@@ -61,7 +62,9 @@ export function useDebounce<T>(source: Ref<T>, options: number | UseDebounceOpti
updateValue();
}, delay);
}
});
return clearTimers;
}, [source]);
// 卸载
onUnmounted(() => {