支持表头出现滚动条
This commit is contained in:
parent
ed58d29fcc
commit
4048c71a0f
|
@ -11275,7 +11275,8 @@
|
||||||
_props3$scroll = _props3.scroll,
|
_props3$scroll = _props3.scroll,
|
||||||
scroll = _props3$scroll === undefined ? {} : _props3$scroll,
|
scroll = _props3$scroll === undefined ? {} : _props3$scroll,
|
||||||
getBodyWrapper = _props3.getBodyWrapper,
|
getBodyWrapper = _props3.getBodyWrapper,
|
||||||
footerScroll = _props3.footerScroll;
|
footerScroll = _props3.footerScroll,
|
||||||
|
headerScroll = _props3.headerScroll;
|
||||||
var useFixedHeader = this.props.useFixedHeader;
|
var useFixedHeader = this.props.useFixedHeader;
|
||||||
|
|
||||||
var bodyStyle = _extends({}, this.props.bodyStyle);
|
var bodyStyle = _extends({}, this.props.bodyStyle);
|
||||||
|
@ -11307,8 +11308,18 @@
|
||||||
// Add negative margin bottom for scroll bar overflow bug
|
// Add negative margin bottom for scroll bar overflow bug
|
||||||
var scrollbarWidth = (0, _utils.measureScrollbar)();
|
var scrollbarWidth = (0, _utils.measureScrollbar)();
|
||||||
if (scrollbarWidth >= 0) {
|
if (scrollbarWidth >= 0) {
|
||||||
(fixed ? bodyStyle : headStyle).marginBottom = '-' + scrollbarWidth + 'px';
|
|
||||||
(fixed ? bodyStyle : headStyle).paddingBottom = '0px';
|
(fixed ? bodyStyle : headStyle).paddingBottom = '0px';
|
||||||
|
//显示表头滚动条
|
||||||
|
if (headerScroll) {
|
||||||
|
if (fixed) {
|
||||||
|
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px';
|
||||||
|
headStyle.marginBottom = scrollbarWidth + 'px';
|
||||||
|
} else {
|
||||||
|
headStyle.marginBottom = '0px';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(fixed ? bodyStyle : headStyle).marginBottom = '-' + scrollbarWidth + 'px';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
14
src/Table.js
14
src/Table.js
|
@ -614,7 +614,7 @@ class Table extends Component {
|
||||||
|
|
||||||
getTable(options = {}) {
|
getTable(options = {}) {
|
||||||
const { columns, fixed } = options;
|
const { columns, fixed } = options;
|
||||||
const { clsPrefix, scroll = {}, getBodyWrapper, footerScroll } = this.props;
|
const { clsPrefix, scroll = {}, getBodyWrapper, footerScroll,headerScroll } = this.props;
|
||||||
let { useFixedHeader } = this.props;
|
let { useFixedHeader } = this.props;
|
||||||
const bodyStyle = { ...this.props.bodyStyle };
|
const bodyStyle = { ...this.props.bodyStyle };
|
||||||
const headStyle = {};
|
const headStyle = {};
|
||||||
|
@ -645,8 +645,18 @@ class Table extends Component {
|
||||||
// Add negative margin bottom for scroll bar overflow bug
|
// Add negative margin bottom for scroll bar overflow bug
|
||||||
const scrollbarWidth = measureScrollbar();
|
const scrollbarWidth = measureScrollbar();
|
||||||
if (scrollbarWidth >= 0) {
|
if (scrollbarWidth >= 0) {
|
||||||
(fixed ? bodyStyle : headStyle).marginBottom = `-${scrollbarWidth}px`;
|
|
||||||
(fixed ? bodyStyle : headStyle).paddingBottom = '0px';
|
(fixed ? bodyStyle : headStyle).paddingBottom = '0px';
|
||||||
|
//显示表头滚动条
|
||||||
|
if(headerScroll){
|
||||||
|
if(fixed){
|
||||||
|
bodyStyle.marginBottom = `-${scrollbarWidth}px`;
|
||||||
|
headStyle.marginBottom = `${scrollbarWidth}px`;
|
||||||
|
}else{
|
||||||
|
headStyle.marginBottom = `0px`;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
(fixed ? bodyStyle : headStyle).marginBottom = `-${scrollbarWidth}px`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue