From ca1aa4a4135954272d0b2a3fe84fc685741a6570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Mon, 9 Dec 2024 23:45:02 +0800 Subject: [PATCH] docs(web): add `Tree` FAQ (#1998) * docs(web): add `Tree` FAQ * docs(web): update `Tree` FAQ and add information about unique values in `Tree` structure --- docs/web/api/tree.en-US.md | 11 +++++++++++ docs/web/api/tree.md | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/web/api/tree.en-US.md b/docs/web/api/tree.en-US.md index 8d028f3bf5..55ec0c0b1f 100644 --- a/docs/web/api/tree.en-US.md +++ b/docs/web/api/tree.en-US.md @@ -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. \ No newline at end of file diff --git a/docs/web/api/tree.md b/docs/web/api/tree.md index 9cdb4f3ed1..79a5669701 100644 --- a/docs/web/api/tree.md +++ b/docs/web/api/tree.md @@ -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` 值都是唯一的,不可重复。 \ No newline at end of file