Skip to content

Commit

Permalink
fix(table): do not calculate th width if props.showHeader=false (#2909)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaishi authored Nov 15, 2023
1 parent cd492bc commit 1008fa3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/table/hooks/useFixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ export default function useFixed(

const calculateThWidthList = (trList: HTMLCollection) => {
const widthMap: { [colKey: string]: number } = {};
if (!trList) return widthMap;
for (let i = 0, len = trList.length; i < len; i++) {
const thList = trList[i].children;
// second for used for multiple row header
Expand Down Expand Up @@ -501,6 +502,7 @@ export default function useFixed(
);

watch([finalColumns], ([finalColumns], [preFinalColumns]) => {
if (!props.showHeader) return;
const finalColKeys = finalColumns.map((t) => t.colKey);
const preColKeys = preFinalColumns.map((t) => t.colKey);
if (finalColKeys.length < preColKeys.length) {
Expand Down

0 comments on commit 1008fa3

Please sign in to comment.