Table: fix a script error when show-header is true. (#1248)

pull/1260/head
FuryBean 2016-11-21 19:01:31 +08:00 committed by cinwell.li
parent 34e01710b5
commit 6353d33afe
1 changed files with 11 additions and 9 deletions

View File

@ -194,20 +194,22 @@
const { bodyWrapper, headerWrapper } = this.$refs; const { bodyWrapper, headerWrapper } = this.$refs;
const refs = this.$refs; const refs = this.$refs;
bodyWrapper.addEventListener('scroll', function() { bodyWrapper.addEventListener('scroll', function() {
headerWrapper.scrollLeft = this.scrollLeft; if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft;
if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop; if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop; if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
}); });
mousewheel(headerWrapper, throttle(16, function(event) { if (headerWrapper) {
const deltaX = event.deltaX; mousewheel(headerWrapper, throttle(16, function(event) {
const deltaX = event.deltaX;
if (deltaX > 0) { if (deltaX > 0) {
bodyWrapper.scrollLeft = bodyWrapper.scrollLeft + 10; bodyWrapper.scrollLeft = bodyWrapper.scrollLeft + 10;
} else { } else {
bodyWrapper.scrollLeft = bodyWrapper.scrollLeft - 10; bodyWrapper.scrollLeft = bodyWrapper.scrollLeft - 10;
} }
})); }));
}
if (this.fit) { if (this.fit) {
this.windowResizeListener = throttle(50, () => { this.windowResizeListener = throttle(50, () => {