diff --git a/components/tooltip/Tooltip.tsx b/components/tooltip/Tooltip.tsx index 560ae47bd..0df852a35 100644 --- a/components/tooltip/Tooltip.tsx +++ b/components/tooltip/Tooltip.tsx @@ -75,7 +75,7 @@ export default defineComponent({ slots: ['title'], // emits: ['update:visible', 'visibleChange'], setup(props, { slots, emit, attrs, expose }) { - const { prefixCls, getTargetContainer } = useConfigInject('tooltip', props); + const { prefixCls, getPopupContainer } = useConfigInject('tooltip', props); const visible = ref(firstNotUndefined([props.visible, props.defaultVisible])); @@ -217,7 +217,7 @@ export default defineComponent({ }; return () => { - const { openClassName, getPopupContainer, color, overlayClassName } = props; + const { openClassName, color, overlayClassName } = props; let children = filterEmpty(slots.default?.()) ?? null; children = children.length === 1 ? children[0] : children; @@ -245,12 +245,11 @@ export default defineComponent({ formattedOverlayInnerStyle = { backgroundColor: color }; arrowContentStyle = { backgroundColor: color }; } - const vcTooltipProps = { ...attrs, ...(props as TooltipProps), prefixCls: prefixCls.value, - getTooltipContainer: getPopupContainer || getTargetContainer.value, + getPopupContainer: getPopupContainer.value, builtinPlacements: tooltipPlacements.value, visible: tempVisible, ref: tooltip, diff --git a/components/vc-tooltip/src/Tooltip.tsx b/components/vc-tooltip/src/Tooltip.tsx index 8f6d53daf..12b6eff51 100644 --- a/components/vc-tooltip/src/Tooltip.tsx +++ b/components/vc-tooltip/src/Tooltip.tsx @@ -22,7 +22,7 @@ export default defineComponent({ prefixCls: PropTypes.string.def('rc-tooltip'), mouseEnterDelay: PropTypes.number.def(0.1), mouseLeaveDelay: PropTypes.number.def(0.1), - getTooltipContainer: Function, + getPopupContainer: Function as PropType<(triggerNode?: HTMLElement) => HTMLElement>, destroyTooltipOnHide: { type: Boolean, default: false }, align: PropTypes.object.def(() => ({})), arrowContent: PropTypes.any.def(null), @@ -94,7 +94,6 @@ export default defineComponent({ align, destroyTooltipOnHide, defaultVisible, - getTooltipContainer, ...restProps } = props; const extraProps = { ...restProps }; @@ -109,7 +108,6 @@ export default defineComponent({ builtinPlacements: placements, popupPlacement: placement, popupAlign: align, - getPopupContainer: getTooltipContainer, afterPopupVisibleChange: afterVisibleChange, popupTransitionName: transitionName, popupAnimation: animation,