Skip to content

Commit 4f9b677

Browse files
committed
fix: tooltip global getPopupContainer not work, #5636
1 parent 44e1f02 commit 4f9b677

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

components/tooltip/Tooltip.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default defineComponent({
7575
slots: ['title'],
7676
// emits: ['update:visible', 'visibleChange'],
7777
setup(props, { slots, emit, attrs, expose }) {
78-
const { prefixCls, getTargetContainer } = useConfigInject('tooltip', props);
78+
const { prefixCls, getPopupContainer } = useConfigInject('tooltip', props);
7979

8080
const visible = ref(firstNotUndefined([props.visible, props.defaultVisible]));
8181

@@ -217,7 +217,7 @@ export default defineComponent({
217217
};
218218

219219
return () => {
220-
const { openClassName, getPopupContainer, color, overlayClassName } = props;
220+
const { openClassName, color, overlayClassName } = props;
221221
let children = filterEmpty(slots.default?.()) ?? null;
222222
children = children.length === 1 ? children[0] : children;
223223

@@ -245,12 +245,11 @@ export default defineComponent({
245245
formattedOverlayInnerStyle = { backgroundColor: color };
246246
arrowContentStyle = { backgroundColor: color };
247247
}
248-
249248
const vcTooltipProps = {
250249
...attrs,
251250
...(props as TooltipProps),
252251
prefixCls: prefixCls.value,
253-
getTooltipContainer: getPopupContainer || getTargetContainer.value,
252+
getPopupContainer: getPopupContainer.value,
254253
builtinPlacements: tooltipPlacements.value,
255254
visible: tempVisible,
256255
ref: tooltip,

components/vc-tooltip/src/Tooltip.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default defineComponent({
2222
prefixCls: PropTypes.string.def('rc-tooltip'),
2323
mouseEnterDelay: PropTypes.number.def(0.1),
2424
mouseLeaveDelay: PropTypes.number.def(0.1),
25-
getTooltipContainer: Function,
25+
getPopupContainer: Function as PropType<(triggerNode?: HTMLElement) => HTMLElement>,
2626
destroyTooltipOnHide: { type: Boolean, default: false },
2727
align: PropTypes.object.def(() => ({})),
2828
arrowContent: PropTypes.any.def(null),
@@ -94,7 +94,6 @@ export default defineComponent({
9494
align,
9595
destroyTooltipOnHide,
9696
defaultVisible,
97-
getTooltipContainer,
9897
...restProps
9998
} = props;
10099
const extraProps = { ...restProps };
@@ -109,7 +108,6 @@ export default defineComponent({
109108
builtinPlacements: placements,
110109
popupPlacement: placement,
111110
popupAlign: align,
112-
getPopupContainer: getTooltipContainer,
113111
afterPopupVisibleChange: afterVisibleChange,
114112
popupTransitionName: transitionName,
115113
popupAnimation: animation,

0 commit comments

Comments
 (0)