diff --git a/packages/components/table/src/store/tree.ts b/packages/components/table/src/store/tree.ts index 12097d4656..276d4bf2f6 100644 --- a/packages/components/table/src/store/tree.ts +++ b/packages/components/table/src/store/tree.ts @@ -77,8 +77,7 @@ function useTree(watcherData: WatcherPropsData) { 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(watcherData: WatcherPropsData) { } } // 合并 expanded 与 display,确保数据刷新后,状态不变 - keys.forEach((key) => { + nested.forEach((_, key) => { const oldValue = oldTreeData[key] const newValue = { ...nested.get(key) } newValue.expanded = getExpanded(oldValue, key)