Skip to content

Commit

Permalink
修复虚拟滚动启用后 scrollTo 无效问题 #2512
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Aug 8, 2024
1 parent 60737a8 commit 1a24c17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "4.7.62",
"version": "4.7.63",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down Expand Up @@ -28,7 +28,7 @@
"style": "lib/style.css",
"typings": "types/index.d.ts",
"dependencies": {
"vxe-pc-ui": "^4.0.91"
"vxe-pc-ui": "^4.0.92"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
7 changes: 4 additions & 3 deletions packages/table/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export function rowToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
} else {
// 如果是虚拟渲染跨行滚动
if (scrollYLoad) {
return $xeTable.scrollTo(null, (afterFullData.indexOf(row) - 1) * scrollYStore.rowHeight)
return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * scrollYStore.rowHeight)
}
}
}
Expand Down Expand Up @@ -438,10 +438,11 @@ export function colToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
if (scrollXLoad) {
let scrollLeft = 0
for (let index = 0; index < visibleColumn.length; index++) {
if (visibleColumn[index] === column) {
const currCol = visibleColumn[index]
if (currCol === column || currCol.id === column.id) {
break
}
scrollLeft += visibleColumn[index].renderWidth
scrollLeft += currCol.renderWidth
}
return $xeTable.scrollTo(scrollLeft)
}
Expand Down

0 comments on commit 1a24c17

Please sign in to comment.