From 1a24c17f48a5a554e7b835ddfd5070d9ca2715e8 Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Thu, 8 Aug 2024 18:15:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=99=9A=E6=8B=9F=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E5=90=AF=E7=94=A8=E5=90=8E=20scrollTo=20=E6=97=A0?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98=20#2512?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- packages/table/src/util.ts | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a050251ba7..75c9e73d3a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/table/src/util.ts b/packages/table/src/util.ts index 4bb3a275ea..9b1d9b1488 100644 --- a/packages/table/src/util.ts +++ b/packages/table/src/util.ts @@ -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) }