From 7a9111032669b0393702b6866f65be6f6d00abd8 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 15 May 2022 10:14:11 +0800 Subject: [PATCH] fix: global validateMessages no work, close #5599 --- components/_util/hooks/useConfigInject.ts | 2 ++ components/form/Form.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/components/_util/hooks/useConfigInject.ts b/components/_util/hooks/useConfigInject.ts index 079ac95b3..be02d9241 100644 --- a/components/_util/hooks/useConfigInject.ts +++ b/components/_util/hooks/useConfigInject.ts @@ -4,6 +4,7 @@ import { computed, inject } from 'vue'; import type { ConfigProviderProps, CSPConfig, Direction, SizeType } from '../../config-provider'; import { defaultConfigProvider } from '../../config-provider'; import type { VueNode } from '../type'; +import type { ValidateMessages } from '../../form/interface'; export default ( name: string, @@ -20,6 +21,7 @@ export default ( form?: ComputedRef<{ requiredMark?: RequiredMark; colon?: boolean; + validateMessages?: ValidateMessages; }>; autoInsertSpaceInButton: ComputedRef; renderEmpty?: ComputedRef<(componentName?: string) => VueNode>; diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 1f6ac45ee..7716f889d 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -130,6 +130,7 @@ const Form = defineComponent({ const validateMessages = computed(() => { return { ...defaultValidateMessages, + ...contextForm.value?.validateMessages, ...props.validateMessages, }; });