Skip to content
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(web): add Tree FAQ #1998

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` 值都是唯一的,不可重复。
Loading