fix(components): [table] expanded rows cannot be updated using array methods (#23761)

* fix(components): [table] expanded rows cannot be updated using array methods

* test: add case

* test: apply coderabbit suggest
This commit is contained in:
rzzf
2026-03-12 09:03:27 +08:00
committed by GitHub
parent b128fbc79e
commit 341a08c353
2 changed files with 21 additions and 1 deletions

View File

@@ -2056,6 +2056,25 @@ describe('Table.vue', () => {
childRows.forEach((item) => {
expect(item.attributes('style')).toContain('')
})
// #23759
wrapper.vm.expandRowKeys.splice(1, 1)
await doubleWait()
childRows = wrapper.findAll('.el-table__row--level-1')
childRows.forEach((item, index) => {
if (index < 2) {
expect(item.attributes('style')).not.toContain('display: none')
} else {
expect(item.attributes('style')).toContain('display: none')
}
})
wrapper.vm.expandRowKeys.push('1999-3-31')
await doubleWait()
childRows = wrapper.findAll('.el-table__row--level-1')
childRows.forEach((item) => {
expect(item.attributes('style')).not.toContain('display: none')
})
})
it('expand-row-keys & toggleRowExpansion', async () => {

View File

@@ -148,7 +148,8 @@ function useTree<T extends DefaultRow>(watcherData: WatcherPropsData<T>) {
() => expandRowKeys.value,
() => {
updateTreeData(true)
}
},
{ deep: true }
)
watch(