Commit 7f2e78d8db1df647108444f7124faffd9c0598be
1 parent
e25070eb
Decrease table scroll speed
Showing
1 changed file
with
8 additions
and
7 deletions
Show diff stats
src/components/table/table.vue
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | :data="rebuildData"></table-head> | 12 | :data="rebuildData"></table-head> |
13 | </div> | 13 | </div> |
14 | <div :class="[prefixCls + '-body']" :style="bodyStyle" ref="body" @scroll="handleBodyScroll" | 14 | <div :class="[prefixCls + '-body']" :style="bodyStyle" ref="body" @scroll="handleBodyScroll" |
15 | + @mousewheel="handleFixedMousewheel" | ||
15 | v-show="!((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))"> | 16 | v-show="!((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))"> |
16 | <table-body | 17 | <table-body |
17 | ref="tbody" | 18 | ref="tbody" |
@@ -48,7 +49,7 @@ | @@ -48,7 +49,7 @@ | ||
48 | :data="rebuildData"></table-head> | 49 | :data="rebuildData"></table-head> |
49 | </div> | 50 | </div> |
50 | <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedBody" | 51 | <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedBody" |
51 | - @wheel="handleFixedMousewheel"> | 52 | + @mousewheel="handleFixedMousewheel"> |
52 | <table-body | 53 | <table-body |
53 | fixed="left" | 54 | fixed="left" |
54 | :prefix-cls="prefixCls" | 55 | :prefix-cls="prefixCls" |
@@ -71,7 +72,7 @@ | @@ -71,7 +72,7 @@ | ||
71 | :data="rebuildData"></table-head> | 72 | :data="rebuildData"></table-head> |
72 | </div> | 73 | </div> |
73 | <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedRightBody" | 74 | <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedRightBody" |
74 | - @wheel="handleFixedMousewheel"> | 75 | + @mousewheel="handleFixedMousewheel"> |
75 | <table-body | 76 | <table-body |
76 | fixed="right" | 77 | fixed="right" |
77 | :prefix-cls="prefixCls" | 78 | :prefix-cls="prefixCls" |
@@ -554,17 +555,17 @@ | @@ -554,17 +555,17 @@ | ||
554 | //body.scrollTop += deltaY; | 555 | //body.scrollTop += deltaY; |
555 | let step = 0; | 556 | let step = 0; |
556 | let timeId = setInterval(()=>{ | 557 | let timeId = setInterval(()=>{ |
557 | - step+=10; | 558 | + step += 5; |
558 | if(deltaY>0){ | 559 | if(deltaY>0){ |
559 | - body.scrollTop += 10; | 560 | + body.scrollTop += 2; |
560 | } | 561 | } |
561 | else{ | 562 | else{ |
562 | - body.scrollTop += -10; | 563 | + body.scrollTop -= 2; |
563 | } | 564 | } |
564 | - if(step>=Math.abs(deltaY)){ | 565 | + if(step >= Math.abs(deltaY)){ |
565 | clearInterval(timeId); | 566 | clearInterval(timeId); |
566 | } | 567 | } |
567 | - } , 20); | 568 | + }, 5); |
568 | }, | 569 | }, |
569 | handleMouseWheel (event) { | 570 | handleMouseWheel (event) { |
570 | const deltaX = event.deltaX; | 571 | const deltaX = event.deltaX; |