table ellipsis not work at fixed column

pull/3053/head
tangjinzhou 2020-10-27 23:02:20 +08:00
parent db63f369e1
commit cd52fec722
1 changed files with 10 additions and 2 deletions

View File

@ -141,7 +141,7 @@ const BaseTable = {
render() {
const { sComponents: components, prefixCls, scroll, data } = this.table;
const { expander, tableClassName, hasHead, hasBody, fixed, isAnyColumnsFixed } = this.$props;
const columns = this.getColumns();
const tableStyle = {};
if (!fixed && scroll.x) {
@ -153,6 +153,14 @@ const BaseTable = {
tableStyle.width =
typeof tableStyle.width === 'number' ? `${tableStyle.width}px` : tableStyle.width;
}
if (fixed) {
const width = columns.reduce((sum, { width: w }) => {
return sum + parseFloat(w, 10);
}, 0);
if (width > 0) {
tableStyle.width = width + 'px';
}
}
const Table = hasBody ? components.table : 'table';
const BodyWrapper = components.body.wrapper;
@ -161,7 +169,7 @@ const BaseTable = {
if (hasBody) {
body = <BodyWrapper class={`${prefixCls}-tbody`}>{this.renderRows(data, 0)}</BodyWrapper>;
}
const columns = this.getColumns();
return (
<Table class={tableClassName} style={tableStyle} key="table">
<ColGroup columns={columns} fixed={fixed} />