-
Notifications
You must be signed in to change notification settings - Fork 360
feat(popup): add multiple instance methods to popup component #3925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
格式乱了
There was a problem hiding this comment.
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' }), | ||
| /** 获取浮层元素 */ |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?.(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
popper还能没有update?

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
📝 更新日志
feat(popup): 添加多个组件实例方法
getOverlay(获取浮层元素)、getOverlayState(获取浮层悬浮状态)、getPopper(获取当前组件 popper 实例)、update(更新浮层内容)本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单