Skip to content

Commit 054b180

Browse files
committed
refactor: 更改计算 theader 宽度逻辑
1 parent b56e72e commit 054b180

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/BootstrapBlazor/Components/Table/Table.razor.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,10 @@ const autoFitColumnWidth = async (table, col) => {
744744

745745
if (table.options.fitColumnWidthIncludeHeader) {
746746
const th = col.closest('th');
747-
maxWidth = Math.max(maxWidth, calcCellWidth(th));
747+
const span = th.querySelector('.table-cell');
748+
const thStyle = getComputedStyle(th);
749+
const margin = parseFloat(thStyle.getPropertyValue('padding-left')) + parseFloat(thStyle.getPropertyValue('padding-right'))
750+
maxWidth = Math.max(maxWidth, calcCellWidth(span)) + margin;
748751
}
749752

750753
if (table.options.autoFitColumnWidthCallback !== null) {

0 commit comments

Comments
 (0)