fix: ConfigProvider error for style, close #6368

pull/6382/head
tangjinzhou 2023-03-21 15:08:16 +08:00
parent 4d2a37fcd3
commit bfcbd5bdef
1 changed files with 5 additions and 4 deletions

View File

@ -27,8 +27,7 @@ import {
import { useProviderSize } from './SizeContext';
import { useProviderDisabled } from './DisabledContext';
import { createTheme } from '../_util/cssinjs';
import { useDesignTokenProvider } from '../theme/internal';
import { toReactive } from '../_util/toReactive';
import { DesignTokenProvider } from '../theme/internal';
export type {
ConfigProviderProps,
@ -235,7 +234,6 @@ const ConfigProvider = defineComponent({
},
};
});
useDesignTokenProvider(toReactive(memoTheme));
const validateMessagesRef = computed(() => {
// Additional Form provider
let validateMessages: ValidateMessages = {};
@ -257,9 +255,12 @@ const ConfigProvider = defineComponent({
useProviderDisabled(componentDisabled);
const renderProvider = (legacyLocale: Locale) => {
let childNode = shouldWrapSSR.value ? wrapSSR(slots.default?.()) : slots.default?.();
if (props.theme)
childNode = <DesignTokenProvider value={memoTheme.value}>{childNode}</DesignTokenProvider>;
return (
<LocaleProvider locale={locale.value || legacyLocale} ANT_MARK__={ANT_MARK}>
{shouldWrapSSR.value ? wrapSSR(slots.default?.()) : slots.default?.()}
{childNode}
</LocaleProvider>
);
};