refactor(components): [table] compatible with rowKey non-existence (#21134)

* refactor(components): [table] compatible with rowKey non-existence

* chore: update

* fix: update
This commit is contained in:
btea
2025-06-25 22:39:32 +08:00
committed by GitHub
parent 82fa008537
commit 7a499bf40f

View File

@@ -77,8 +77,7 @@ function useTree<T>(watcherData: WatcherPropsData<T>) {
const nested = normalizedData.value
const normalizedLazyNode_ = normalizedLazyNode.value
const newTreeData = {}
if (nested.size) {
const keys = Array.from(nested.keys())
if (nested instanceof Map && nested.size) {
const oldTreeData = unref(treeData)
const rootLazyRowKeys = []
const getExpanded = (oldValue, key) => {
@@ -96,7 +95,7 @@ function useTree<T>(watcherData: WatcherPropsData<T>) {
}
}
// 合并 expanded 与 display确保数据刷新后状态不变
keys.forEach((key) => {
nested.forEach((_, key) => {
const oldValue = oldTreeData[key]
const newValue = { ...nested.get(key) }
newValue.expanded = getExpanded(oldValue, key)