Skip to content

Commit ae8fa54

Browse files
author
luchunyu
committed
fix(table): changing custom scrollbar style to origin
1 parent a2f0d6d commit ae8fa54

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/components/table/index.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,17 @@
5252

5353
.c-scroll__thead {
5454
overflow-x: hidden;
55+
overflow-y: scroll;
5556

5657
& table {
5758
table-layout: fixed;
5859
}
5960
}
6061

62+
.c-fixtable__left .c-scroll__thead {
63+
overflow-y: hidden;
64+
}
65+
6166
.c-table__body table {
6267
width: 100%;
6368
margin: 0;
@@ -68,6 +73,9 @@
6873
.c-scroll__tbody,
6974
.c-scrolltable {
7075
overflow-x: auto;
76+
position: relative;
77+
-ms-scroll-chaining: none;
78+
overscroll-behavior: none;
7179

7280
& table {
7381
table-layout: fixed;
@@ -177,6 +185,9 @@
177185

178186
.c-table__body {
179187
overflow-y: auto;
188+
position: relative;
189+
-ms-scroll-chaining: none;
190+
overscroll-behavior: none;
180191
}
181192

182193
.c-table__all.c-table {

src/components/table/index.vue

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ div(:class="className")
8484
template(v-else)
8585
+TableWithHeight("fixedRightColumns", "fixedright", "onYscroll", "true")
8686
template(v-else)
87+
.c-scrolltable(@scroll="onScroll")
88+
+Table("columns")
8789
.c-fixtable__left(
8890
:class="{'c-fixed__leftscroll': isScrollMove}"
8991
v-if="fixedLeftColumns.length > 0"
@@ -92,8 +94,6 @@ div(:class="className")
9294
+Table("fixedLeftColumns")
9395
template(v-else)
9496
+Table("fixedLeftColumns", "true")
95-
.c-scrolltable(@scroll="onScroll")
96-
+Table("columns")
9797
.c-fixtable__right(
9898
:class="{'c-fixed__rightscroll': isScrollMove}"
9999
v-if="fixedRightColumns.length > 0"
@@ -300,11 +300,7 @@ export default {
300300
tbodyEl.style.maxHeight = `${this.height - theadHeight}px`
301301
},
302302
getCurrentScrollBarSize () {
303-
const ua = window.navigator.userAgent
304-
if (ua.indexOf('MSIE') > 0 ||
305-
Boolean(ua.match(/Trident.*rv:11./))) {
306-
this.scrollBarSize = getScrollBarSize()
307-
}
303+
this.scrollBarSize = getScrollBarSize()
308304
},
309305
rowEnter (index) {
310306
this.hoverRowIndex = index
@@ -326,7 +322,6 @@ export default {
326322
scrollEl.scrollTop = e.target.scrollTop
327323
},
328324
onScroll (e) {
329-
const maxWidth = e.target.scrollWidth - e.target.offsetWidth
330325
if (!e.target.className.includes(this.scrollBox)) {
331326
// fix mouseleave but scroll is keeping
332327
e.target.scrollTop = this.$refs.fixedleft.scrollTop
@@ -343,10 +338,6 @@ export default {
343338
if (this.$refs.fixedright) {
344339
this.$refs.fixedright.scrollTop = scrollTop
345340
}
346-
if (scrollLeft > maxWidth) {
347-
e.target.scrollLeft = maxWidth
348-
return
349-
}
350341
if (scrollEl) {
351342
scrollEl.scrollLeft = scrollLeft
352343
}

0 commit comments

Comments
 (0)