From 154de681868d7d643cf48c631e69e23125bbb5cc Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Wed, 16 Oct 2024 14:33:41 +0800 Subject: [PATCH] releases 4.7.89 --- examples/views/table/TableTest8.vue | 128 +++++++++++++++++----------- package.json | 2 +- packages/table/src/util.ts | 9 +- 3 files changed, 82 insertions(+), 57 deletions(-) diff --git a/examples/views/table/TableTest8.vue b/examples/views/table/TableTest8.vue index b15b6124ae..882d7f224b 100644 --- a/examples/views/table/TableTest8.vue +++ b/examples/views/table/TableTest8.vue @@ -1,34 +1,18 @@ diff --git a/package.json b/package.json index 9c3485040d..15c1b06738 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "4.7.88", + "version": "4.7.89", "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...", "scripts": { "update": "npm install --legacy-peer-deps", diff --git a/packages/table/src/util.ts b/packages/table/src/util.ts index 7e5a964f9c..2552cd0585 100644 --- a/packages/table/src/util.ts +++ b/packages/table/src/util.ts @@ -433,17 +433,18 @@ export function colToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet if (tdElem) { const tdOffsetParent = tdElem.offsetParent as HTMLElement const tdOffsetLeft = tdElem.offsetLeft + (tdOffsetParent ? tdOffsetParent.offsetLeft : 0) - const tdWidth = tdElem.clientWidth + const cellWidth = tdElem.clientWidth // 检测是否在可视区中 if (tdOffsetLeft < (bodySrcollLeft + offsetFixedLeft)) { return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 1) - } else if ((tdOffsetLeft + tdWidth) >= (bodyWidth + bodySrcollLeft - offsetFixedRight)) { - return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - offsetFixedRight + 1) + } else if ((tdOffsetLeft + cellWidth - bodySrcollLeft) > (bodyWidth - offsetFixedRight)) { + return $xeTable.scrollTo((tdOffsetLeft + cellWidth) - (bodyWidth - offsetFixedRight - 1)) } } else { // 检测是否在虚拟渲染可视区中 if (scrollXLoad) { let scrollLeft = 0 + const cellWidth = column.renderWidth for (let index = 0; index < visibleColumn.length; index++) { const currCol = visibleColumn[index] if (currCol === column || currCol.id === column.id) { @@ -454,7 +455,7 @@ export function colToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet if (scrollLeft < bodySrcollLeft) { return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - 1) } - return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - offsetFixedRight + 1) + return $xeTable.scrollTo((scrollLeft + cellWidth) - (bodyWidth - offsetFixedRight - 1)) } } }