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 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 defaultRenderEmpty from './renderEmpty';
|
||||||
import type { RenderEmptyHandler } from './renderEmpty';
|
import type { RenderEmptyHandler } from './renderEmpty';
|
||||||
import type { Locale } from '../locale-provider';
|
import type { Locale } from '../locale-provider';
|
||||||
|
@ -157,6 +157,13 @@ const ConfigProvider = defineComponent({
|
||||||
() => props.autoInsertSpaceInButton ?? parentContext.autoInsertSpaceInButton?.value,
|
() => props.autoInsertSpaceInButton ?? parentContext.autoInsertSpaceInButton?.value,
|
||||||
);
|
);
|
||||||
const locale = computed(() => props.locale || parentContext.locale?.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 direction = computed(() => props.direction || parentContext.direction?.value);
|
||||||
const space = computed(() => props.space ?? parentContext.space?.value);
|
const space = computed(() => props.space ?? parentContext.space?.value);
|
||||||
const virtual = computed(() => props.virtual ?? parentContext.virtual?.value);
|
const virtual = computed(() => props.virtual ?? parentContext.virtual?.value);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import type { App, VNode, PropType } from 'vue';
|
import type { App, VNode, PropType } from 'vue';
|
||||||
import { provide, defineComponent, reactive, watch } from 'vue';
|
import { provide, defineComponent, reactive, watch } from 'vue';
|
||||||
import type { ModalLocale } from '../modal/locale';
|
import type { ModalLocale } from '../modal/locale';
|
||||||
|
import { changeConfirmLocale } from '../modal/locale';
|
||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import { withInstall } from '../_util/type';
|
import { withInstall } from '../_util/type';
|
||||||
import type { ValidateMessages } from '../form/interface';
|
import type { ValidateMessages } from '../form/interface';
|
||||||
|
@ -81,9 +82,10 @@ const LocaleProvider = defineComponent({
|
||||||
provide('localeData', state);
|
provide('localeData', state);
|
||||||
watch(
|
watch(
|
||||||
() => props.locale,
|
() => props.locale,
|
||||||
() => {
|
locale => {
|
||||||
|
changeConfirmLocale(locale && locale.Modal);
|
||||||
state.antLocale = {
|
state.antLocale = {
|
||||||
...props.locale,
|
...locale,
|
||||||
exist: true,
|
exist: true,
|
||||||
} as any;
|
} as any;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue