diff --git a/build/Table.js b/build/Table.js index 4800464..4f83324 100644 --- a/build/Table.js +++ b/build/Table.js @@ -781,7 +781,7 @@ var Table = function (_Component) { //显示表头滚动条 if (headerScroll) { if (fixed) { - //内容少,不用显示滚动条 + if (this.domWidthDiff <= 0) { headStyle.marginBottom = scrollbarWidth + 'px'; bodyStyle.marginBottom = '-' + scrollbarWidth + 'px'; diff --git a/build/lib/filterColumn.js b/build/lib/filterColumn.js index 64b7f50..782461f 100644 --- a/build/lib/filterColumn.js +++ b/build/lib/filterColumn.js @@ -212,6 +212,17 @@ function filterColumn(Table, Popover) { var columns = _this2.state.columns; return columns.map(function (da, i) { + var paramObj = { + id: da.key, + checked: da.checked + }; + if (da.fixed) { + paramObj.disabled = true; + } else { + paramObj.onClick = function () { + _this2.checkedColumItemClick(da); + }; + } return _react2["default"].createElement( "div", @@ -219,14 +230,7 @@ function filterColumn(Table, Popover) { key: da.key + "_" + i, className: prefixCls + "-pop-cont-item" }, - _react2["default"].createElement(_beeCheckbox2["default"], { - id: da.key, - disabled: da.fixed, - checked: da.checked, - onClick: function onClick() { - _this2.checkedColumItemClick(da); - } - }), + _react2["default"].createElement(_beeCheckbox2["default"], paramObj), _react2["default"].createElement( "span", null, diff --git a/build/utils.js b/build/utils.js index 1f6f0e6..b083509 100644 --- a/build/utils.js +++ b/build/utils.js @@ -42,7 +42,7 @@ function measureScrollbar() { if (typeof document === 'undefined' || typeof window === 'undefined') { return 0; } - if (scrollbarWidth) { + if (window.scrollbarWidth) { return scrollbarWidth; } var scrollDiv = document.createElement('div'); @@ -55,6 +55,7 @@ function measureScrollbar() { var width = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); scrollbarWidth = width; + window.scrollbarWidth = scrollbarWidth; return scrollbarWidth; } diff --git a/src/Table.js b/src/Table.js index 489b3ba..fd783cd 100644 --- a/src/Table.js +++ b/src/Table.js @@ -681,7 +681,7 @@ class Table extends Component { //显示表头滚动条 if(headerScroll){ if(fixed){ - //内容少,不用显示滚动条 + if(this.domWidthDiff <= 0){ headStyle.marginBottom = `${scrollbarWidth}px`; bodyStyle.marginBottom = `-${scrollbarWidth}px`; diff --git a/src/utils.js b/src/utils.js index ad105e0..41d0b3d 100644 --- a/src/utils.js +++ b/src/utils.js @@ -17,8 +17,8 @@ export function measureScrollbar() { if (typeof document === 'undefined' || typeof window === 'undefined') { return 0; } - if (scrollbarWidth) { - return scrollbarWidth; + if (window.scrollbarWidth) { + return window.scrollbarWidth; } const scrollDiv = document.createElement('div'); for (const scrollProp in scrollbarMeasure) { @@ -30,6 +30,7 @@ export function measureScrollbar() { const width = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); scrollbarWidth = width; + window.scrollbarWidth = scrollbarWidth; return scrollbarWidth; }