fix(scroll为y时宽度计算问题bug):

This commit is contained in:
wanghaoo 2018-11-08 17:55:09 +08:00
parent 2ecdcf74e4
commit c5789893cf
2 changed files with 7 additions and 3 deletions

View File

@ -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';
//显示表头滚动条

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "1.4.35",
"version": "1.4.36",
"description": "Table ui component for react",
"keywords": [
"react",