vxe-table 3.9.8 → 3.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -393,17 +393,18 @@ export function colToVisible ($xeTable: any, column: any) {
393
393
  const tdElem = bodyElem.querySelector(`.${column.id}`)
394
394
  if (tdElem) {
395
395
  const tdOffsetLeft = tdElem.offsetLeft + (tdElem.offsetParent ? tdElem.offsetParent.offsetLeft : 0)
396
- const tdWidth = tdElem.clientWidth
397
- // 检测行是否在可视区中
396
+ const cellWidth = tdElem.clientWidth
397
+ // 检测是否在可视区中
398
398
  if (tdOffsetLeft < (bodySrcollLeft + offsetFixedLeft)) {
399
399
  return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 1)
400
- } else if ((tdOffsetLeft + tdWidth) >= (bodyWidth + bodySrcollLeft - offsetFixedRight)) {
401
- return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - offsetFixedRight + 1)
400
+ } else if ((tdOffsetLeft + cellWidth - bodySrcollLeft) > (bodyWidth - offsetFixedRight)) {
401
+ return $xeTable.scrollTo((tdOffsetLeft + cellWidth) - (bodyWidth - offsetFixedRight - 1))
402
402
  }
403
403
  } else {
404
404
  // 检测是否在虚拟渲染可视区中
405
405
  if (scrollXLoad) {
406
406
  let scrollLeft = 0
407
+ const cellWidth = column.renderWidth
407
408
  for (let index = 0; index < visibleColumn.length; index++) {
408
409
  if (visibleColumn[index] === column) {
409
410
  break
@@ -413,7 +414,7 @@ export function colToVisible ($xeTable: any, column: any) {
413
414
  if (scrollLeft < bodySrcollLeft) {
414
415
  return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - 1)
415
416
  }
416
- return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - offsetFixedRight + 1)
417
+ return $xeTable.scrollTo((scrollLeft + cellWidth) - (bodyWidth - offsetFixedRight - 1))
417
418
  }
418
419
  }
419
420
  }