Skip to content

Commit

Permalink
docs(web): add Tree FAQ (#1998)
Browse files Browse the repository at this point in the history
* docs(web): add `Tree` FAQ

* docs(web): update `Tree` FAQ and add information about unique values in `Tree` structure
  • Loading branch information
RSS1102 authored Dec 9, 2024
1 parent 324c0c0 commit ca1aa4a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/web/api/tree.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,14 @@ Connects parent nodes in the tree with their child nodes at the same level. This
### Why doesn't the `onChange` callback return the value of the parent node when child node is selected in `valueMode = 'all'` mode?

In `valueMode = 'all'` mode, the parent node will only appear in the selected values if all its child nodes are selected.

### Why do other nodes get selected when I select a node?

The `value` field of each item in the `data` array provided to the `Tree` component must be unique to avoid multiple selection issues caused by duplicate indices.

### Why can't I expand nodes correctly even though I set `expanded`?

The `value` field of each item in the `data` array provided to the `Tree` component must be unique to avoid incorrect expansion caused by duplicate indices.

### Are `value` or unique `key` values in any level of the `Tree` structure non-repetitive?
Yes, `value` or value defined by the alias `keys` in any level of the `Tree` structure are unique and non-repetitive.
12 changes: 12 additions & 0 deletions docs/web/api/tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,15 @@ spline: data
### 为什么在 `valueMode = 'all'` 模式下,选中子节点时 `onChange` 回调并没有返回父节点的值?

`valueMode = 'all'` 模式下,必须当前子节点被全部选中后,父节点才会出现在选中值里面。

### 为什么我选中了一个选中了一个节点,但是其他节点也有被选中的情况?

提供给 `Tree` 组件的数组 `data` 数据中的每个 `value` 字段的值必须是唯一的,避免重复索引导致多选问题。

### 为什么我设置了 `expanded` 却不能正确展开节点?

提供给 `Tree` 组件的数组 `data` 数据中的每个 `value` 字段的值必须是唯一的,避免重复索引导致不能正确展开。

### `Tree` 中任意一级结构中的 `value` 或唯一 `key` 值都不可重复吗?

是的, 在 `Tree` 中任意一级结构中的 `value` 或使用 `keys` 别名定义的 `value` 值都是唯一的,不可重复。

0 comments on commit ca1aa4a

Please sign in to comment.