ant-design/components/tooltip/shared/sharedFAQ.zh-CN.md
Dan M. 7da2f1fb8d
docs: add FAQ for Tooltip/Popover/Popcomfirm custom component usage (#53026)
* Add FAQ entry for Toolkit + custom component

* Add tooltip example for custom component

* Add link to example in Tooltip doc page

* Add link to issue

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: Dan M. <danspamable@gmail.com>

* Replace custom props with HTMLSpanElement props

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: Dan M. <danspamable@gmail.com>

* Import handlers as types

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: Dan M. <danspamable@gmail.com>

* Fix formatting

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: Dan M. <danspamable@gmail.com>

* Update components/tooltip/demo/wrap-custom-component.tsx

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: Dan M. <danspamable@gmail.com>

* Update components/tooltip/index.en-US.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: Dan M. <danspamable@gmail.com>

* Add link for Wrap Custom Component

* Update components/tooltip/demo/wrap-custom-component.tsx

Signed-off-by: thinkasany <480968828@qq.com>

* test: update snap

* fix md lint

* chore: update docs

---------

Signed-off-by: Dan M. <danspamable@gmail.com>
Signed-off-by: thinkasany <480968828@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: 𝑾𝒖𝒙𝒉 <wxh1220@gmail.com>
2025-03-06 10:06:11 +08:00

1.7 KiB
Raw Blame History

为何在严格模式中有时候会出现 findDOMNode is deprecated 这个警告?

这是由于 rc-trigger 的实现方式导致的,rc-trigger 强制要求 children 能够接受 ref否则就会 fallback 到 findDOMNode所以 children 需要是原生 html 标签,如果不是,则需要使用 React.forwardRefref 透传到原生 html 标签。

为什么自定义子组件无法正常工作?

类似问题: #15909, #12812

请确保子元素能接受 onMouseEnteronMouseLeaveonPointerEnteronPointerLeaveonFocusonClick 事件。参考示例

placement 的行为逻辑是什么?

当屏幕空间足够时,会按照 placement 的设置进行弹层。当空间不足时则会取反向位置进行弹层(例如 top 不够时,会改为 bottomtopLeft 不够时会改为 bottomLeft)。单一方向如 top bottom left right 当贴边时进行自动位移:

shift

当设置为边缘对齐方向如 topLeft bottomRight 等,则会仅做翻转而不做位移。