From 3efc8f8eec0ff2d3401b1717c9043c5ded748fb8 Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Thu, 29 Nov 2018 17:12:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1=E5=9C=A8iframe?= =?UTF-8?q?=E4=B8=8B=E5=AE=BD=E5=BA=A6=E8=AE=A1=E7=AE=97=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/Table.js | 2 +- build/lib/filterColumn.js | 20 ++++++++++++-------- build/utils.js | 3 ++- src/Table.js | 2 +- src/utils.js | 5 +++-- 5 files changed, 19 insertions(+), 13 deletions(-) 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; }