docs: Add faq about item height (#21433)

* docs: Add faq about item height

* update
This commit is contained in:
二货机器人 2020-02-18 17:29:35 +08:00 committed by GitHub
parent 8738e1a623
commit 0ea16a8841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 0 deletions

View File

@ -100,3 +100,13 @@ Select component to select value from options.
### The dropdown is closed when click `dropdownRender` area? ### The dropdown is closed when click `dropdownRender` area?
See the [dropdownRender example](/components/select/#components-select-demo-custom-dropdown-menu). See the [dropdownRender example](/components/select/#components-select-demo-custom-dropdown-menu).
### Why sometime customize Option cause scroll break?
Virtual scroll internal set item height as `32px`. You need to adjust `listItemHeight` when your option height is less and `listHeight` config list container height:
```tsx
<Select listItemHeight={10} listHeight={250} />
```
Note: `listItemHeight` and `listHeight` are internal props. Please only modify when necessary.

View File

@ -103,3 +103,13 @@ title: Select
### 点击 `dropdownRender` 里的内容浮层关闭怎么办? ### 点击 `dropdownRender` 里的内容浮层关闭怎么办?
看下 [dropdownRender 例子](/components/select-cn/#components-select-demo-custom-dropdown-menu) 里的说明。 看下 [dropdownRender 例子](/components/select-cn/#components-select-demo-custom-dropdown-menu) 里的说明。
### 自定义 Option 样式导致滚动异常怎么办?
这是由于虚拟滚动默认选项高度为 `32px`,如果你的选项高度小于该值则需要通过 `listItemHeight` 属性调整,而 `listHeight` 用于设置滚动容器高度:
```tsx
<Select listItemHeight={10} listHeight={250} />
```
注意:`listItemHeight` 和 `listHeight` 为内部属性,如无必要,请勿修改该值。

View File

@ -81,3 +81,7 @@ Tree selection control.
### How to get parent node in onChange? ### How to get parent node in onChange?
We don't provide this since performance consideration. You can get by this way: <https://codesandbox.io/s/wk080nn81k> We don't provide this since performance consideration. You can get by this way: <https://codesandbox.io/s/wk080nn81k>
### Why sometime customize Option cause scroll break?
You can ref Select [FAQ](/components/select).

View File

@ -82,3 +82,7 @@ title: TreeSelect
### onChange 时如何获得父节点信息? ### onChange 时如何获得父节点信息?
从性能角度考虑,我们默认不透出父节点信息。你可以这样获得:<https://codesandbox.io/s/wk080nn81k> 从性能角度考虑,我们默认不透出父节点信息。你可以这样获得:<https://codesandbox.io/s/wk080nn81k>
### 自定义 Option 样式导致滚动异常怎么办?
请参考 Select 的 [FAQ](/components/select)。