docs: Add DatePicker panelRender FAQ

close #27263
This commit is contained in:
zombiej 2020-10-21 11:38:18 +08:00
parent 0822ac618f
commit 07506792fc
2 changed files with 8 additions and 0 deletions

View File

@ -185,6 +185,10 @@ DatePicker default set `locale` as `en` in v4. You can config DatePicker `locale
Please use correct [language](/docs/react/i18n) ([#5605](https://github.com/ant-design/ant-design/issues/5605)), or update moment `locale` config: <https://codesandbox.io/s/moment-day-of-week-6dby5>
### Why origin panel don't switch when using `panelRender`?
When you change the layout of nodes by `panelRender`, React will unmount and re-mount it which reset the component state. You should keep the layout stable. Please ref [#27263](https://github.com/ant-design/ant-design/issues/27263) for more info.
```js
moment.locale('en', {
week: {

View File

@ -186,6 +186,10 @@ v4 中DatePicker 默认 `locale` 为 `en`。你可以通过 DatePicker 的 `l
请使用正确的[语言包](/docs/react/i18n)[#5605](https://github.com/ant-design/ant-design/issues/5605)),或者修改 moment 的 `locale` 配置:<https://codesandbox.io/s/moment-day-of-week-6dby5>
### 为何使用 `panelRender` 时,原来面板无法切换?
当你通过 `panelRender` 动态改变层级结构时,会使得原本的 Panel 被当做新的节点删除并创建。这使得其原本的状态会被重置,保持结构稳定即可。详情请参考 [#27263](https://github.com/ant-design/ant-design/issues/27263)。
```js
moment.locale('en', {
// 注意请修改你正在使用的 locale 语言,比如 zh-cn