Skip to content

Commit

Permalink
fix: 修复 rules 未设置且 validate 方法 validateOnly 为 true 时报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
welkang authored and yinkaihui committed Apr 12, 2024
1 parent 59770cd commit 4bf5d7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions components/Form/__test__/validate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ describe('validate form', () => {
>
<Input placeholder="please enter your username" />
</Form.Item>
<Form.Item label="Password" field="password" required>
<Input placeholder="please enter your password" />
</Form.Item>
</Form>
);

Expand Down
2 changes: 1 addition & 1 deletion components/Form/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function isSyntheticEvent(e: any): boolean {
}

export async function schemaValidate(field, value, _rules: RulesProps[], validateMessages) {
const rules: RulesProps[] = [..._rules];
const rules: RulesProps[] = [...(_rules || [])];
let current = 0;

return new Promise(async (resolve) => {
Expand Down

0 comments on commit 4bf5d7c

Please sign in to comment.