Skip to content

Commit

Permalink
fix: newColumnsMap 和 columns数据不一致导致的报错 (#2091)
Browse files Browse the repository at this point in the history
* fix: newColumnsMap 和 columns数据不一致导致的报错

* fix: 修改判断逻辑

* fix: return 空函数,防止调用updateFixedStatus报错(onResize)
  • Loading branch information
thinkanymore committed Feb 3, 2023
1 parent 97936a6 commit a4c742a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/table/hooks/useFixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ export default function useFixed(
// 多级表头,使用父元素作为初始基本位置
const defaultWidth = i === columns.length - 1 ? parent?.right || 0 : 0;
const lastColInfo = initialColumnMap.get(lastCol?.colKey || i + 1);
colInfo.right = (lastColInfo?.right || defaultWidth) + (lastColInfo?.width || 0);
if (colInfo) {
colInfo.right = (lastColInfo?.right || defaultWidth) + (lastColInfo?.width || 0);
}
// 多级表头
if (col.children?.length) {
setFixedRightPos(col.children, initialColumnMap, colInfo);
Expand Down Expand Up @@ -345,6 +347,7 @@ export default function useFixed(

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const updateFixedStatus = () => {
if (!(columns.value?.length)) return () => {};
const { newColumnsMap, levelNodes } = getColumnMap(columns.value);
setIsLastOrFirstFixedCol(levelNodes);
const timer = setTimeout(() => {
Expand Down

0 comments on commit a4c742a

Please sign in to comment.