We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
使用 DialogPlugin 将 body 设置为自定义组件后,该组件无法获取到调用组件的上下文
类似于 antd 的 useModal,通过自定义埋点使用DialogPlugin方法后内部的子组件可以获取到父级的上下文数据。
`
Modal.useModal() 当你需要使用 Context 时,可以通过 Modal.useModal 创建一个 contextHolder 插入子节点中。通过 hooks 创建的临时 Modal 将会得到 contextHolder 所在位置的所有上下文。创建的 modal 对象拥有与 Modal.method 相同的创建通知方法。
const [modal, contextHolder] = Modal.useModal();
React.useEffect(() => { modal.confirm({ // ... }); }, []);
return
The text was updated successfully, but these errors were encountered:
👋 @duxphp,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。
Sorry, something went wrong.
♥️ 有劳 @ldwonday @psaren @huoyuhao @honkinglin 尽快确认问题。 确认有效后将下一步计划和可能需要的时间回复给 @duxphp 。
duplicate of #2455
honkinglin
No branches or pull requests
这个功能解决了什么问题
使用 DialogPlugin 将 body 设置为自定义组件后,该组件无法获取到调用组件的上下文
你建议的方案是什么
类似于 antd 的 useModal,通过自定义埋点使用DialogPlugin方法后内部的子组件可以获取到父级的上下文数据。
`
Modal.useModal()
当你需要使用 Context 时,可以通过 Modal.useModal 创建一个 contextHolder 插入子节点中。通过 hooks 创建的临时 Modal 将会得到 contextHolder 所在位置的所有上下文。创建的 modal 对象拥有与 Modal.method 相同的创建通知方法。
const [modal, contextHolder] = Modal.useModal();
React.useEffect(() => {
modal.confirm({
// ...
});
}, []);
return
`
The text was updated successfully, but these errors were encountered: