mousewheel support firefox and safari
This commit is contained in:
parent
7f2e78d8db
commit
e970884b3c
1 changed files with 19 additions and 4 deletions
|
@ -12,7 +12,7 @@
|
||||||
:data="rebuildData"></table-head>
|
:data="rebuildData"></table-head>
|
||||||
</div>
|
</div>
|
||||||
<div :class="[prefixCls + '-body']" :style="bodyStyle" ref="body" @scroll="handleBodyScroll"
|
<div :class="[prefixCls + '-body']" :style="bodyStyle" ref="body" @scroll="handleBodyScroll"
|
||||||
@mousewheel="handleFixedMousewheel"
|
@mousewheel="handleFixedMousewheel" @DOMMouseScroll="handleFixedMousewheel"
|
||||||
v-show="!((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
|
v-show="!((!!localeNoDataText && (!data || data.length === 0)) || (!!localeNoFilteredDataText && (!rebuildData || rebuildData.length === 0)))">
|
||||||
<table-body
|
<table-body
|
||||||
ref="tbody"
|
ref="tbody"
|
||||||
|
@ -49,7 +49,8 @@
|
||||||
:data="rebuildData"></table-head>
|
:data="rebuildData"></table-head>
|
||||||
</div>
|
</div>
|
||||||
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedBody"
|
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedBody"
|
||||||
@mousewheel="handleFixedMousewheel">
|
@mousewheel="handleFixedMousewheel" @DOMMouseScroll="handleFixedMousewheel"
|
||||||
|
@touchmove="handleFixedTouchmove">
|
||||||
<table-body
|
<table-body
|
||||||
fixed="left"
|
fixed="left"
|
||||||
:prefix-cls="prefixCls"
|
:prefix-cls="prefixCls"
|
||||||
|
@ -72,7 +73,8 @@
|
||||||
:data="rebuildData"></table-head>
|
:data="rebuildData"></table-head>
|
||||||
</div>
|
</div>
|
||||||
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedRightBody"
|
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" ref="fixedRightBody"
|
||||||
@mousewheel="handleFixedMousewheel">
|
@mousewheel="handleFixedMousewheel" @DOMMouseScroll="handleFixedMousewheel"
|
||||||
|
@touchmove="handleFixedTouchmove">
|
||||||
<table-body
|
<table-body
|
||||||
fixed="right"
|
fixed="right"
|
||||||
:prefix-cls="prefixCls"
|
:prefix-cls="prefixCls"
|
||||||
|
@ -542,8 +544,21 @@
|
||||||
if (this.isRightFixed) this.$refs.fixedRightBody.scrollTop = event.target.scrollTop;
|
if (this.isRightFixed) this.$refs.fixedRightBody.scrollTop = event.target.scrollTop;
|
||||||
this.hideColumnFilter();
|
this.hideColumnFilter();
|
||||||
},
|
},
|
||||||
|
handleFixedTouchmove(event){
|
||||||
|
//console.log(event);
|
||||||
|
if(event.touches && event.touches.length && event.touches.length===1){
|
||||||
|
//const body = this.$refs.body;
|
||||||
|
}
|
||||||
|
},
|
||||||
handleFixedMousewheel(event) {
|
handleFixedMousewheel(event) {
|
||||||
const deltaY = event.deltaY;
|
let deltaY = event.deltaY;
|
||||||
|
if(!deltaY && event.detail){
|
||||||
|
deltaY = event.detail * 40;
|
||||||
|
}
|
||||||
|
if(!deltaY && event.wheelDeltaY){
|
||||||
|
deltaY = -event.wheelDeltaY;
|
||||||
|
}
|
||||||
|
if(!deltaY) return;
|
||||||
const body = this.$refs.body;
|
const body = this.$refs.body;
|
||||||
const currentScrollTop = body.scrollTop;
|
const currentScrollTop = body.scrollTop;
|
||||||
if (deltaY < 0 && currentScrollTop !== 0) {
|
if (deltaY < 0 && currentScrollTop !== 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue