diff --git a/build/Table.js b/build/Table.js index d4204b1..d225674 100644 --- a/build/Table.js +++ b/build/Table.js @@ -211,6 +211,10 @@ var Table = function (_Component) { Table.prototype.componentDidMount = function componentDidMount() { setTimeout(this.resetScrollY, 300); + //含有纵向滚动条 + if (this.props.scroll.y) { + this.scrollbarWidth = (0, _utils.measureScrollbar)(); + } //后续也放在recevice里面 if (!this.props.originWidth) { this.computeTableWidth(); @@ -290,7 +294,7 @@ var Table = function (_Component) { var lastShowIndex = computeObj.lastShowIndex; this.computeWidth = computeObj.computeWidth; if (this.computeWidth < this.contentWidth) { - var contentWidthDiff = this.contentWidth - this.computeWidth; + var contentWidthDiff = this.scrollbarWidth ? this.contentWidth - this.computeWidth - this.scrollbarWidth : this.contentWidth - this.computeWidth; this.setState({ contentWidthDiff: contentWidthDiff, lastShowIndex: lastShowIndex }); } else { this.contentWidth = this.computeWidth; @@ -740,7 +744,7 @@ var Table = function (_Component) { useFixedHeader = true; // Add negative margin bottom for scroll bar overflow bug - var scrollbarWidth = (0, _utils.measureScrollbar)(); + var scrollbarWidth = this.scrollbarWidth; if (scrollbarWidth >= 0) { (fixed ? bodyStyle : headStyle).paddingBottom = '0px'; //显示表头滚动条 diff --git a/package.json b/package.json index 138033d..620e67f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "1.4.35", + "version": "1.4.36", "description": "Table ui component for react", "keywords": [ "react",