fix: scrollbar css

This commit is contained in:
gx-mac 2021-03-01 02:04:13 +08:00
parent e1d73a9c33
commit abf567d6da
1 changed files with 9 additions and 2 deletions

View File

@ -286,8 +286,12 @@ class Table extends Component {
// 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断 // 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断
this.isShowScrollY(); this.isShowScrollY();
if (this.bodyTable) { if (this.bodyTable) {
if (!this.props.scroll.x && window.getComputedStyle(this.bodyTable).overflowX !== 'hidden') { const currentOverflowX = window.getComputedStyle(this.bodyTable).overflowX
this.bodyTable.style.overflowX = 'hidden' if (!this.props.scroll.x && currentOverflowX === 'scroll') {
this.bodyTable.style.overflowX = 'hidden';
}
if (this.props.scroll.x && currentOverflowX !== 'scroll') {
this.bodyTable.style.overflowX = 'scroll';
} }
} }
if (this.bodyTableOuter) { // 隐藏几个不需要真正滚动的父元素的滚动条 if (this.bodyTableOuter) { // 隐藏几个不需要真正滚动的父元素的滚动条
@ -1021,6 +1025,9 @@ class Table extends Component {
// bodyStyle.height = bodyStyle.height || scroll.y; // bodyStyle.height = bodyStyle.height || scroll.y;
innerBodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y; innerBodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y;
innerBodyStyle.overflowY = bodyStyle.overflowY || 'scroll'; innerBodyStyle.overflowY = bodyStyle.overflowY || 'scroll';
if (scroll.x) {
innerBodyStyle.overflowX = 'scroll';
}
} else { } else {
bodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y; bodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y;
} }