mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user