fix: tooltip global getPopupContainer not work, #5636

pull/5642/head
tangjinzhou 3 years ago
parent 44e1f020c8
commit 4f9b677555

@ -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,

@ -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,

Loading…
Cancel
Save