fix: tooltip global getPopupContainer not work, #5636

pull/5642/head
tangjinzhou 2022-05-24 15:12:08 +08:00
parent 44e1f020c8
commit 4f9b677555
2 changed files with 4 additions and 7 deletions

View File

@ -75,7 +75,7 @@ export default defineComponent({
slots: ['title'], slots: ['title'],
// emits: ['update:visible', 'visibleChange'], // emits: ['update:visible', 'visibleChange'],
setup(props, { slots, emit, attrs, expose }) { 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])); const visible = ref(firstNotUndefined([props.visible, props.defaultVisible]));
@ -217,7 +217,7 @@ export default defineComponent({
}; };
return () => { return () => {
const { openClassName, getPopupContainer, color, overlayClassName } = props; const { openClassName, color, overlayClassName } = props;
let children = filterEmpty(slots.default?.()) ?? null; let children = filterEmpty(slots.default?.()) ?? null;
children = children.length === 1 ? children[0] : children; children = children.length === 1 ? children[0] : children;
@ -245,12 +245,11 @@ export default defineComponent({
formattedOverlayInnerStyle = { backgroundColor: color }; formattedOverlayInnerStyle = { backgroundColor: color };
arrowContentStyle = { backgroundColor: color }; arrowContentStyle = { backgroundColor: color };
} }
const vcTooltipProps = { const vcTooltipProps = {
...attrs, ...attrs,
...(props as TooltipProps), ...(props as TooltipProps),
prefixCls: prefixCls.value, prefixCls: prefixCls.value,
getTooltipContainer: getPopupContainer || getTargetContainer.value, getPopupContainer: getPopupContainer.value,
builtinPlacements: tooltipPlacements.value, builtinPlacements: tooltipPlacements.value,
visible: tempVisible, visible: tempVisible,
ref: tooltip, ref: tooltip,

View File

@ -22,7 +22,7 @@ export default defineComponent({
prefixCls: PropTypes.string.def('rc-tooltip'), prefixCls: PropTypes.string.def('rc-tooltip'),
mouseEnterDelay: PropTypes.number.def(0.1), mouseEnterDelay: PropTypes.number.def(0.1),
mouseLeaveDelay: 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 }, destroyTooltipOnHide: { type: Boolean, default: false },
align: PropTypes.object.def(() => ({})), align: PropTypes.object.def(() => ({})),
arrowContent: PropTypes.any.def(null), arrowContent: PropTypes.any.def(null),
@ -94,7 +94,6 @@ export default defineComponent({
align, align,
destroyTooltipOnHide, destroyTooltipOnHide,
defaultVisible, defaultVisible,
getTooltipContainer,
...restProps ...restProps
} = props; } = props;
const extraProps = { ...restProps }; const extraProps = { ...restProps };
@ -109,7 +108,6 @@ export default defineComponent({
builtinPlacements: placements, builtinPlacements: placements,
popupPlacement: placement, popupPlacement: placement,
popupAlign: align, popupAlign: align,
getPopupContainer: getTooltipContainer,
afterPopupVisibleChange: afterVisibleChange, afterPopupVisibleChange: afterVisibleChange,
popupTransitionName: transitionName, popupTransitionName: transitionName,
popupAnimation: animation, popupAnimation: animation,