Skip to content

Commit 1207090

Browse files
committed
feature: fixed header add class on vertical scroll
1 parent 2215330 commit 1207090

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/ve-table/src/index.jsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ export default {
360360
isLeftScrolling: false,
361361
// is scrolling right
362362
isRightScrolling: false,
363+
// is scrolling vertically
364+
isVerticalScrolling: false,
363365
// has horizontal scroll bar
364366
hasXScrollBar: false,
365367
// has vertical scroll bar
@@ -588,6 +590,7 @@ export default {
588590
isVirtualScroll,
589591
isLeftScrolling,
590592
isRightScrolling,
593+
isVerticalScrolling,
591594
isCellEditing,
592595
isAutofillStarting,
593596
enableCellSelection,
@@ -598,6 +601,7 @@ export default {
598601
[clsName("virtual-scroll")]: isVirtualScroll,
599602
[clsName("container-left-scrolling")]: isLeftScrolling,
600603
[clsName("container-right-scrolling")]: isRightScrolling,
604+
[clsName("container-vertical-scrolling")]: isVerticalScrolling,
601605
[clsName("is-cell-editing")]: isCellEditing,
602606
[clsName("autofilling")]: isAutofillStarting,
603607
// 如果开启单元格选择,则关闭 user-select
@@ -2050,10 +2054,10 @@ export default {
20502054

20512055
// set scrolling
20522056
setScrolling(tableContainerRef) {
2053-
if (this.hasFixedColumn) {
2054-
const { scrollWidth, clientWidth, scrollLeft } =
2055-
tableContainerRef;
2057+
const { scrollWidth, clientWidth, scrollLeft, scrollTop } =
2058+
tableContainerRef;
20562059

2060+
if (this.hasFixedColumn) {
20572061
const { previewTableContainerScrollLeft: previewScrollLeft } =
20582062
this;
20592063

@@ -2071,6 +2075,10 @@ export default {
20712075
this.isLeftScrolling = scrollLeft > 0;
20722076
this.isRightScrolling = scrollWidth - clientWidth > scrollLeft;
20732077
}
2078+
2079+
if (this.fixedHeader) {
2080+
this.isVerticalScrolling = scrollTop > 0;
2081+
}
20742082
},
20752083

20762084
// set scroll bar status

0 commit comments

Comments
 (0)