Commit 7f2e78d8db1df647108444f7124faffd9c0598be

Authored by huanghong
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 12 :data="rebuildData"></table-head>
13 13 </div>
14 14 <div :class="[prefixCls + '-body']" :style="bodyStyle" ref="body" @scroll="handleBodyScroll"
  15 + @mousewheel="handleFixedMousewheel"
15 16 v-show="!((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
16 17 <table-body
17 18 ref="tbody"
... ... @@ -48,7 +49,7 @@
48 49 :data="rebuildData"></table-head>
49 50 </div>
50 51 <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedBody"
51   - @wheel="handleFixedMousewheel">
  52 + @mousewheel="handleFixedMousewheel">
52 53 <table-body
53 54 fixed="left"
54 55 :prefix-cls="prefixCls"
... ... @@ -71,7 +72,7 @@
71 72 :data="rebuildData"></table-head>
72 73 </div>
73 74 <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedRightBody"
74   - @wheel="handleFixedMousewheel">
  75 + @mousewheel="handleFixedMousewheel">
75 76 <table-body
76 77 fixed="right"
77 78 :prefix-cls="prefixCls"
... ... @@ -554,17 +555,17 @@
554 555 //body.scrollTop += deltaY;
555 556 let step = 0;
556 557 let timeId = setInterval(()=>{
557   - step+=10;
  558 + step += 5;
558 559 if(deltaY>0){
559   - body.scrollTop += 10;
  560 + body.scrollTop += 2;
560 561 }
561 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 566 clearInterval(timeId);
566 567 }
567   - } , 20);
  568 + }, 5);
568 569 },
569 570 handleMouseWheel (event) {
570 571 const deltaX = event.deltaX;
... ...