滚动条在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 (fixed) {
//内容少,不用显示滚动条
if (this.domWidthDiff <= 0) {
headStyle.marginBottom = scrollbarWidth + 'px';
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px';

View File

@ -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,

View File

@ -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;
}

View File

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

View File

@ -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;
}