From 33ca7ee4f06febfd9bcec33bb66e62e27f0102c1 Mon Sep 17 00:00:00 2001
From: yujinpan <1192878390@qq.com>
Date: Wed, 30 Nov 2022 23:43:57 +0800
Subject: [PATCH] fix(components): [TreeSelect] incorrect label when child not
rendered (#10716)
* feat: add `treeEach` utility function
* fix(components): [TreeSelect] incorrect label when child not rendered
* docs(components): [TreeSelect] remove tips for resolved issues
* fix(components): [TreeSelect] add `cacheData` props for lazy label
* docs(components): [TreeSelect] add `cacheData` document and examples
* docs(components): [TreeSelect] add version identification for new props
* refactor(components): [TreeSelect] replace any type
* docs(components): [TreeSelect] update version tag
---
docs/en-US/component/tree-select.md | 14 +++----
docs/examples/tree-select/lazy.vue | 12 ++++++
.../__tests__/tree-select.test.tsx | 41 +++++++++++++++++++
.../tree-select/src/cache-options.ts | 28 +++++++++++++
.../tree-select/src/tree-select.vue | 15 ++++++-
packages/components/tree-select/src/tree.ts | 33 ++++++++++++++-
packages/components/tree-select/src/utils.ts | 17 ++++++++
7 files changed, 149 insertions(+), 11 deletions(-)
create mode 100644 packages/components/tree-select/src/cache-options.ts
diff --git a/docs/en-US/component/tree-select.md b/docs/en-US/component/tree-select.md
index c8180b3173..dea5b828f2 100644
--- a/docs/en-US/component/tree-select.md
+++ b/docs/en-US/component/tree-select.md
@@ -18,14 +18,6 @@ tree-select/basic
:::
-:::tip
-
-Since `render-after-expand` defaults to `true`,
-the selected label name may not be displayed when echoing,
-you can set it to `false` to display the correct name.
-
-:::
-
## Select any level
When using the `check-strictly=true` attribute, any node can be checked,
@@ -107,3 +99,9 @@ and please go to the original component to view the documentation.
| --------------------------------------- | ----------------------------- | ----------------------------------- | ---------------------------------- |
| [tree](./tree.md#attributes) | [tree](./tree.md#method) | [tree](./tree.md#events) | [tree](./tree.md#slots) |
| [select](./select.md#select-attributes) | [select](./select.md#methods) | [select](./select.md#select-events) | [select](./select.md#select-slots) |
+
+### Own Attributes
+
+| Name | Description | Type | Accepted Values | Default |
+| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----- | --------------- | ------- |
+| cacheData | The cached data of the lazy node, the structure is the same as the data, used to get the label of the unloaded data | array | — | — |
diff --git a/docs/examples/tree-select/lazy.vue b/docs/examples/tree-select/lazy.vue
index 2297eee578..ebac394d21 100644
--- a/docs/examples/tree-select/lazy.vue
+++ b/docs/examples/tree-select/lazy.vue
@@ -1,11 +1,23 @@
+
+ show lazy load label:
+