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
docs: add global message use case #48167
base: master
Are you sure you want to change the base?
docs: add global message use case #48167
Conversation
Run & review this pull request in StackBlitz Codeflow. |
👁 Visual Regression Report for PR #48167 Passed ✅
🎊 Congrats! No visual-regression diff found. |
@@ -122,6 +122,76 @@ export default () => { | |||
}; | |||
``` | |||
|
|||
### 全局 JS/TS 使用场景 |
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.
全局 redux 示例已经有过了,再写一个额外的感觉没什么必要。
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.
那个例子,有个问题是没有这一段儿:
// App.tsx
// 将 Toast 组件包裹在 antd 的 App 组件中,以获取上下文
import { App as AntdApp, ConfigProvider, Layout } from 'antd';
import Toast from './toast';
function App() {
return (
<ConfigProvider>
<AntdApp>
<Toast />
</AntdApp>
</ConfigProvider>
);
}
export default App;
导致我作为用户,不知道应该在什么时机导入它?
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.
我写这个全局纯TS里面使用,我觉得这一段儿是比较奇怪的:
<AntdApp>
<Toast />
</AntdApp>
在一个TS文件中使用,需要在我的App.tsx中加这么一段儿,这个文档中没有提到,感觉会挺迷惑的。
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.
调整例子就够了?我理解 redux 一样是可以做数据获取的,不能来个库就写一个
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
我看了一下这个文章:https://ant.design/docs/blog/why-not-static-cn |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #48167 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 736 736
Lines 12690 12690
Branches 3329 3329
=========================================
Hits 12690 12690 ☔ View full report in Codecov by Sentry. |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
CN:
文档中的全局使用
message
用例不够全面。在纯 JS/TS 中使用全局message
这种场景非常常见,按照现有文档中的写法,用户自己做出来比较困难,需要增加例子引导。EN:
The use of the global message in the document is not comprehensive enough. The scenario of using the global message in pure JS/TS is very common. According to the current document, it is difficult for users to do it themselves, and examples need to be added for users.
📝 Changelog
message
的文档例子,在message
和notification
的文档中加入了顶层注册的跳转链接。☑️ Self-Check before Merge