Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(性能优化): 优化滚动性能(表格列/数据相对较多,但是未启用虚拟列表的情况下会产生性能问题) #2722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/table/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2710,7 +2710,14 @@ export default defineComponent({
colRest.$index = $index
}
})
reactData.tableColumn = tableColumn
if (reactData.tableColumn.length !== tableColumn.length) {
reactData.tableColumn = tableColumn
} else {
const columnIds = new Set(reactData.tableColumn.map(item => item.id))
if (!tableColumn.map(item => item.id).every(id => columnIds.has(id))) {
reactData.tableColumn = tableColumn
}
}
}

const handleUpdateColumn = () => {
Expand Down Expand Up @@ -6376,7 +6383,16 @@ export default defineComponent({
rest.$index = $index
}
})
reactData.tableData = tableData
if (tableData.length !== reactData.tableData.length) {
reactData.tableData = tableData
} else {
const reactDataIds = new Set(reactData.tableData.map(row => getRowid($xeTable, row)))
if (
!tableData.map(row => getRowid($xeTable, row)).every(rowid => reactDataIds.has(rowid))
) {
reactData.tableData = tableData
}
}
return nextTick()
},
/**
Expand Down
Loading