滚动条在iframe下宽度计算有问题

This commit is contained in:
wanghaoo 2018-11-29 17:12:28 +08:00
parent c3c3331b51
commit 3efc8f8eec
5 changed files with 19 additions and 13 deletions

View File

@ -781,7 +781,7 @@ var Table = function (_Component) {
//显示表头滚动条 //显示表头滚动条
if (headerScroll) { if (headerScroll) {
if (fixed) { if (fixed) {
//内容少,不用显示滚动条
if (this.domWidthDiff <= 0) { if (this.domWidthDiff <= 0) {
headStyle.marginBottom = scrollbarWidth + 'px'; headStyle.marginBottom = scrollbarWidth + 'px';
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px'; bodyStyle.marginBottom = '-' + scrollbarWidth + 'px';

View File

@ -212,6 +212,17 @@ function filterColumn(Table, Popover) {
var columns = _this2.state.columns; var columns = _this2.state.columns;
return columns.map(function (da, i) { 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( return _react2["default"].createElement(
"div", "div",
@ -219,14 +230,7 @@ function filterColumn(Table, Popover) {
key: da.key + "_" + i, key: da.key + "_" + i,
className: prefixCls + "-pop-cont-item" className: prefixCls + "-pop-cont-item"
}, },
_react2["default"].createElement(_beeCheckbox2["default"], { _react2["default"].createElement(_beeCheckbox2["default"], paramObj),
id: da.key,
disabled: da.fixed,
checked: da.checked,
onClick: function onClick() {
_this2.checkedColumItemClick(da);
}
}),
_react2["default"].createElement( _react2["default"].createElement(
"span", "span",
null, null,

View File

@ -42,7 +42,7 @@ function measureScrollbar() {
if (typeof document === 'undefined' || typeof window === 'undefined') { if (typeof document === 'undefined' || typeof window === 'undefined') {
return 0; return 0;
} }
if (scrollbarWidth) { if (window.scrollbarWidth) {
return scrollbarWidth; return scrollbarWidth;
} }
var scrollDiv = document.createElement('div'); var scrollDiv = document.createElement('div');
@ -55,6 +55,7 @@ function measureScrollbar() {
var width = scrollDiv.offsetWidth - scrollDiv.clientWidth; var width = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv); document.body.removeChild(scrollDiv);
scrollbarWidth = width; scrollbarWidth = width;
window.scrollbarWidth = scrollbarWidth;
return scrollbarWidth; return scrollbarWidth;
} }

View File

@ -681,7 +681,7 @@ class Table extends Component {
//显示表头滚动条 //显示表头滚动条
if(headerScroll){ if(headerScroll){
if(fixed){ if(fixed){
//内容少,不用显示滚动条
if(this.domWidthDiff <= 0){ if(this.domWidthDiff <= 0){
headStyle.marginBottom = `${scrollbarWidth}px`; headStyle.marginBottom = `${scrollbarWidth}px`;
bodyStyle.marginBottom = `-${scrollbarWidth}px`; bodyStyle.marginBottom = `-${scrollbarWidth}px`;

View File

@ -17,8 +17,8 @@ export function measureScrollbar() {
if (typeof document === 'undefined' || typeof window === 'undefined') { if (typeof document === 'undefined' || typeof window === 'undefined') {
return 0; return 0;
} }
if (scrollbarWidth) { if (window.scrollbarWidth) {
return scrollbarWidth; return window.scrollbarWidth;
} }
const scrollDiv = document.createElement('div'); const scrollDiv = document.createElement('div');
for (const scrollProp in scrollbarMeasure) { for (const scrollProp in scrollbarMeasure) {
@ -30,6 +30,7 @@ export function measureScrollbar() {
const width = scrollDiv.offsetWidth - scrollDiv.clientWidth; const width = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv); document.body.removeChild(scrollDiv);
scrollbarWidth = width; scrollbarWidth = width;
window.scrollbarWidth = scrollbarWidth;
return scrollbarWidth; return scrollbarWidth;
} }