diff --git a/components/_util/Portal.tsx b/components/_util/Portal.tsx index 8db5b96b7..7b4f682b2 100644 --- a/components/_util/Portal.tsx +++ b/components/_util/Portal.tsx @@ -1,5 +1,13 @@ import PropTypes from './vue-types'; -import { defineComponent, nextTick, onBeforeMount, onUpdated, Teleport, watch } from 'vue'; +import { + defineComponent, + nextTick, + onBeforeMount, + onMounted, + onUpdated, + Teleport, + watch, +} from 'vue'; import { useInjectPortal } from '../vc-trigger/context'; export default defineComponent({ @@ -17,6 +25,8 @@ export default defineComponent({ const { shouldRender } = useInjectPortal(); onBeforeMount(() => { isSSR = false; + }); + onMounted(() => { if (shouldRender.value) { container = props.getContainer(); } diff --git a/components/config-provider/hooks/useConfigInject.ts b/components/config-provider/hooks/useConfigInject.ts index a2c3cf4d9..9e2dfa544 100644 --- a/components/config-provider/hooks/useConfigInject.ts +++ b/components/config-provider/hooks/useConfigInject.ts @@ -24,7 +24,7 @@ export default (name: string, props: Record) => { () => props.getTargetContainer ?? configProvider.getTargetContainer?.value, ); const getPopupContainer = computed( - () => props.getPopupContainer ?? configProvider.getPopupContainer?.value, + () => props.getContainer ?? props.getPopupContainer ?? configProvider.getPopupContainer?.value, ); const dropdownMatchSelectWidth = computed(