支持隐藏表体滚动条
This commit is contained in:
parent
ebd0111c36
commit
1e42317091
|
@ -745,7 +745,8 @@ var Table = function (_Component) {
|
|||
scroll = _props3$scroll === undefined ? {} : _props3$scroll,
|
||||
getBodyWrapper = _props3.getBodyWrapper,
|
||||
footerScroll = _props3.footerScroll,
|
||||
headerScroll = _props3.headerScroll;
|
||||
headerScroll = _props3.headerScroll,
|
||||
hideBodyScroll = _props3.hideBodyScroll;
|
||||
var useFixedHeader = this.props.useFixedHeader;
|
||||
|
||||
var bodyStyle = _extends({}, this.props.bodyStyle);
|
||||
|
@ -781,7 +782,6 @@ var Table = function (_Component) {
|
|||
//显示表头滚动条
|
||||
if (headerScroll) {
|
||||
if (fixed) {
|
||||
|
||||
if (this.domWidthDiff <= 0) {
|
||||
headStyle.marginBottom = scrollbarWidth + 'px';
|
||||
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px';
|
||||
|
@ -792,6 +792,8 @@ var Table = function (_Component) {
|
|||
//内容少,不用显示滚动条
|
||||
if (this.domWidthDiff > 0) {
|
||||
headStyle.overflowX = 'hidden';
|
||||
} else if (hideBodyScroll) {
|
||||
bodyStyle.overflowX = 'hidden';
|
||||
}
|
||||
headStyle.marginBottom = '0px';
|
||||
}
|
||||
|
|
10
src/Table.js
10
src/Table.js
|
@ -646,7 +646,7 @@ class Table extends Component {
|
|||
|
||||
getTable(options = {}) {
|
||||
const { columns, fixed } = options;
|
||||
const { clsPrefix, scroll = {}, getBodyWrapper, footerScroll,headerScroll } = this.props;
|
||||
const { clsPrefix, scroll = {}, getBodyWrapper, footerScroll,headerScroll,hideBodyScroll } = this.props;
|
||||
let { useFixedHeader } = this.props;
|
||||
const bodyStyle = { ...this.props.bodyStyle };
|
||||
const headStyle = {};
|
||||
|
@ -681,7 +681,6 @@ class Table extends Component {
|
|||
//显示表头滚动条
|
||||
if(headerScroll){
|
||||
if(fixed){
|
||||
|
||||
if(this.domWidthDiff <= 0){
|
||||
headStyle.marginBottom = `${scrollbarWidth}px`;
|
||||
bodyStyle.marginBottom = `-${scrollbarWidth}px`;
|
||||
|
@ -690,11 +689,14 @@ class Table extends Component {
|
|||
}
|
||||
}else{
|
||||
//内容少,不用显示滚动条
|
||||
if(this.domWidthDiff > 0){
|
||||
if(this.domWidthDiff > 0){
|
||||
headStyle.overflowX = 'hidden';
|
||||
}else if(hideBodyScroll){
|
||||
bodyStyle.overflowX = 'hidden';
|
||||
}
|
||||
headStyle.marginBottom = `0px`;
|
||||
}
|
||||
|
||||
}else{
|
||||
if(fixed){
|
||||
if(this.domWidthDiff > 0){
|
||||
|
@ -970,7 +972,7 @@ class Table extends Component {
|
|||
{this.getTitle()}
|
||||
<div className={`${clsPrefix}-content`}>
|
||||
|
||||
<div className={isTableScroll ? `${clsPrefix}-scroll` : ''}>
|
||||
<div className={isTableScroll ? `${clsPrefix}-scroll` : ''} >
|
||||
{this.getTable({ columns: this.columnManager.groupedColumns() })}
|
||||
{this.getEmptyText()}
|
||||
{this.getFooter()}
|
||||
|
|
Loading…
Reference in New Issue