Skip to content

Commit 094972a

Browse files
committed
feat: review
1 parent b5fc268 commit 094972a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/Body/BodyRow.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,18 @@ export function getCellProps<RecordType>(
7474
const addChildrenRowSpan = (rowSpan: number, index2: number) => {
7575
const _index = index2 + 1;
7676
let _rowSpan = rowSpan;
77-
// 下面如果是 0 的,增加 +1 逻辑
78-
const thisCellProps = column.onCell(record, _index);
79-
if (thisCellProps.rowSpan === 0) {
80-
const thisExpanded = expandedKeys.has(getRowKey?.(_index));
81-
if (thisExpanded) {
82-
_rowSpan = _rowSpan + 1;
77+
const rowKey = getRowKey?.(_index);
78+
if (rowKey !== undefined) {
79+
// 下面如果是 0 的,增加 +1 逻辑
80+
const thisCellProps = column.onCell(record, _index);
81+
if (thisCellProps.rowSpan === 0) {
82+
const thisExpanded = expandedKeys.has(getRowKey?.(_index));
83+
if (thisExpanded) {
84+
_rowSpan = _rowSpan + 1;
85+
}
86+
// 继续往下找
87+
return addChildrenRowSpan(_rowSpan, _index);
8388
}
84-
// 继续往下找
85-
return addChildrenRowSpan(_rowSpan, _index);
8689
}
8790
// 找不到后返回
8891
return _rowSpan;

0 commit comments

Comments
 (0)