We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3b8b19e commit 27b258cCopy full SHA for 27b258c
components/form/useForm.ts
@@ -332,16 +332,20 @@ function useForm(
332
return info;
333
};
334
let oldModel = initialModel;
335
+ let isFirstTime = true;
336
const modelFn = (model: { [x: string]: any }) => {
337
const names = [];
338
rulesKeys.value.forEach(key => {
339
const prop = getPropByPath(model, key, false);
340
const oldProp = getPropByPath(oldModel, key, false);
- if (!isEqual(prop.v, oldProp.v)) {
341
+ const isFirstValidation = isFirstTime && options?.immediate && prop.isValid;
342
+
343
+ if (isFirstValidation || !isEqual(prop.v, oldProp.v)) {
344
names.push(key);
345
}
346
});
347
validate(names, { trigger: 'change' });
348
+ isFirstTime = false;
349
oldModel = cloneDeep(model);
350
351
0 commit comments