From 1e42317091ac58f8f376c596c23304d85a32ee01 Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Fri, 30 Nov 2018 14:10:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=9A=90=E8=97=8F=E8=A1=A8?= =?UTF-8?q?=E4=BD=93=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/Table.js | 6 ++++-- src/Table.js | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/build/Table.js b/build/Table.js index 560ef4c..872a362 100644 --- a/build/Table.js +++ b/build/Table.js @@ -745,7 +745,8 @@ var Table = function (_Component) { scroll = _props3$scroll === undefined ? {} : _props3$scroll, getBodyWrapper = _props3.getBodyWrapper, footerScroll = _props3.footerScroll, - headerScroll = _props3.headerScroll; + headerScroll = _props3.headerScroll, + hideBodyScroll = _props3.hideBodyScroll; var useFixedHeader = this.props.useFixedHeader; var bodyStyle = _extends({}, this.props.bodyStyle); @@ -781,7 +782,6 @@ var Table = function (_Component) { //显示表头滚动条 if (headerScroll) { if (fixed) { - if (this.domWidthDiff <= 0) { headStyle.marginBottom = scrollbarWidth + 'px'; bodyStyle.marginBottom = '-' + scrollbarWidth + 'px'; @@ -792,6 +792,8 @@ var Table = function (_Component) { //内容少,不用显示滚动条 if (this.domWidthDiff > 0) { headStyle.overflowX = 'hidden'; + } else if (hideBodyScroll) { + bodyStyle.overflowX = 'hidden'; } headStyle.marginBottom = '0px'; } diff --git a/src/Table.js b/src/Table.js index d5200f8..371ad47 100644 --- a/src/Table.js +++ b/src/Table.js @@ -646,7 +646,7 @@ class Table extends Component { getTable(options = {}) { const { columns, fixed } = options; - const { clsPrefix, scroll = {}, getBodyWrapper, footerScroll,headerScroll } = this.props; + const { clsPrefix, scroll = {}, getBodyWrapper, footerScroll,headerScroll,hideBodyScroll } = this.props; let { useFixedHeader } = this.props; const bodyStyle = { ...this.props.bodyStyle }; const headStyle = {}; @@ -681,7 +681,6 @@ class Table extends Component { //显示表头滚动条 if(headerScroll){ if(fixed){ - if(this.domWidthDiff <= 0){ headStyle.marginBottom = `${scrollbarWidth}px`; bodyStyle.marginBottom = `-${scrollbarWidth}px`; @@ -690,11 +689,14 @@ class Table extends Component { } }else{ //内容少,不用显示滚动条 - if(this.domWidthDiff > 0){ + if(this.domWidthDiff > 0){ headStyle.overflowX = 'hidden'; + }else if(hideBodyScroll){ + bodyStyle.overflowX = 'hidden'; } headStyle.marginBottom = `0px`; } + }else{ if(fixed){ if(this.domWidthDiff > 0){ @@ -970,7 +972,7 @@ class Table extends Component { {this.getTitle()}
-
+
{this.getTable({ columns: this.columnManager.groupedColumns() })} {this.getEmptyText()} {this.getFooter()}