1
0
mirror of synced 2025-11-06 11:20:40 +08:00

修复虚拟滚动启用后 scrollTo 无效问题 #2512

This commit is contained in:
xuliangzhan
2024-08-08 18:15:50 +08:00
parent 60737a8e2f
commit 1a24c17f48
2 changed files with 6 additions and 5 deletions

View File

@@ -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",
@@ -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",

View File

@@ -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)
}
}
}
@@ -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)
}