refactor: ♻️ 使用 useThrottleFn 替代 useDebounceFn,第一次点击立即执行,连续点击不重复提交

Former-commit-id: 04724284e7f4ec30d54a6f0eaec2770818c650e9
This commit is contained in:
haoxr
2023-05-15 07:20:03 +08:00
parent a7dffa79f7
commit a4e31e2ef6

View File

@@ -231,7 +231,7 @@ function resetForm() {
/** /**
* 表单提交 * 表单提交
*/ */
const handleSubmit = useDebounceFn(() => { const handleSubmit = useThrottleFn(() => {
userFormRef.value.validate((valid: any) => { userFormRef.value.validate((valid: any) => {
if (valid) { if (valid) {
const userId = formData.id; const userId = formData.id;
@@ -255,7 +255,7 @@ const handleSubmit = useDebounceFn(() => {
} }
} }
}); });
}, 1000); }, 3000);
/** /**
* 删除用户 * 删除用户