Skip to content

Commit cd52fec

Browse files
committed
table ellipsis not work at fixed column
1 parent db63f36 commit cd52fec

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/vc-table/src/BaseTable.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const BaseTable = {
141141
render() {
142142
const { sComponents: components, prefixCls, scroll, data } = this.table;
143143
const { expander, tableClassName, hasHead, hasBody, fixed, isAnyColumnsFixed } = this.$props;
144-
144+
const columns = this.getColumns();
145145
const tableStyle = {};
146146

147147
if (!fixed && scroll.x) {
@@ -153,6 +153,14 @@ const BaseTable = {
153153
tableStyle.width =
154154
typeof tableStyle.width === 'number' ? `${tableStyle.width}px` : tableStyle.width;
155155
}
156+
if (fixed) {
157+
const width = columns.reduce((sum, { width: w }) => {
158+
return sum + parseFloat(w, 10);
159+
}, 0);
160+
if (width > 0) {
161+
tableStyle.width = width + 'px';
162+
}
163+
}
156164

157165
const Table = hasBody ? components.table : 'table';
158166
const BodyWrapper = components.body.wrapper;
@@ -161,7 +169,7 @@ const BaseTable = {
161169
if (hasBody) {
162170
body = <BodyWrapper class={`${prefixCls}-tbody`}>{this.renderRows(data, 0)}</BodyWrapper>;
163171
}
164-
const columns = this.getColumns();
172+
165173
return (
166174
<Table class={tableClassName} style={tableStyle} key="table">
167175
<ColGroup columns={columns} fixed={fixed} />

0 commit comments

Comments
 (0)