fix(demos): snapshot validated values before asynchronous submissions

This commit is contained in:
maoyingjie
2026-10-28 15:05:09 +08:00
parent 49dd67afac
commit b0f32796cb
6 changed files with 102 additions and 3 deletions
+2 -1
View File
@@ -33,10 +33,11 @@ const isSubmitting = shallowRef(false);
let timer: ReturnType<typeof setTimeout> | undefined;
function submit() {
if (!value.value || isInvalid.value || isSubmitting.value) return;
const submittedValue = value.value;
isSubmitting.value = true;
// Simulate API call
timer = setTimeout(() => {
console.log("Time submitted:", { time: value.value });
console.log("Time submitted:", { time: submittedValue });
value.value = null;
isSubmitting.value = false;
}, 1500);