Skip to content

Conversation

@RSS1102
Copy link
Collaborator

@RSS1102 RSS1102 commented Oct 29, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

  • feat(popup): 添加多个组件实例方法 getOverlay(获取浮层元素)、getOverlayState(获取浮层悬浮状态)、getPopper(获取当前组件 popper 实例)、update(更新浮层内容)

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 29, 2025

tdesign-react-demo

npm i https://pkg.pr.new/tdesign-react@3925

commit: a15ba5d

@github-actions
Copy link
Contributor

完成

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

格式乱了

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

getPortalElement: () => portalRef.current,
getPopupContentElement: () => contentRef.current,
setVisible: (visible: boolean) => onVisibleChange(visible, { trigger: 'document' }),
/** 获取浮层元素 */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里把文档提供的和内部方法/非文档提供的分开吧 不要交叉 未公开的注释说明下

const triggerEl = getRefDom(triggerRef);
// 如果没有渲染弹层或不可见则不触发更新
if (!popupRef.current || !visible) return;
if (!popper) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么还得分两个if?

// popper 的实例内部结构可能是 state.elements.reference
// 尝试兼容不同实现,先赋值再更新
if (popper.state) popper.state.elements.reference = triggerEl;
popper.update?.();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

popper还能没有update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants