fix: modal api method i18n not work, close #6438
parent
be90b53527
commit
d4f2e97ca9
|
@ -1,5 +1,5 @@
|
|||
import type { App, Plugin, WatchStopHandle } from 'vue';
|
||||
import { computed, reactive, defineComponent, watchEffect } from 'vue';
|
||||
import { watch, computed, reactive, defineComponent, watchEffect } from 'vue';
|
||||
import defaultRenderEmpty from './renderEmpty';
|
||||
import type { RenderEmptyHandler } from './renderEmpty';
|
||||
import type { Locale } from '../locale-provider';
|
||||
|
@ -157,6 +157,13 @@ const ConfigProvider = defineComponent({
|
|||
() => props.autoInsertSpaceInButton ?? parentContext.autoInsertSpaceInButton?.value,
|
||||
);
|
||||
const locale = computed(() => props.locale || parentContext.locale?.value);
|
||||
watch(
|
||||
locale,
|
||||
() => {
|
||||
globalConfigBySet.locale = locale.value;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
const direction = computed(() => props.direction || parentContext.direction?.value);
|
||||
const space = computed(() => props.space ?? parentContext.space?.value);
|
||||
const virtual = computed(() => props.virtual ?? parentContext.virtual?.value);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type { App, VNode, PropType } from 'vue';
|
||||
import { provide, defineComponent, reactive, watch } from 'vue';
|
||||
import type { ModalLocale } from '../modal/locale';
|
||||
import { changeConfirmLocale } from '../modal/locale';
|
||||
import warning from '../_util/warning';
|
||||
import { withInstall } from '../_util/type';
|
||||
import type { ValidateMessages } from '../form/interface';
|
||||
|
@ -81,9 +82,10 @@ const LocaleProvider = defineComponent({
|
|||
provide('localeData', state);
|
||||
watch(
|
||||
() => props.locale,
|
||||
() => {
|
||||
locale => {
|
||||
changeConfirmLocale(locale && locale.Modal);
|
||||
state.antLocale = {
|
||||
...props.locale,
|
||||
...locale,
|
||||
exist: true,
|
||||
} as any;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue