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()}