Skip to content

Commit

Permalink
fix(table): fix span problem
Browse files Browse the repository at this point in the history
  • Loading branch information
flsion committed Jan 11, 2024
1 parent 926b68b commit ffe1fe9
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/web-vue/components/table/hooks/use-span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ export const useSpan = ({
if (rowspan > 1 || colspan > 1) {
span[`${rowIndex}-${columnIndex}-${record.key}`] = [rowspan, colspan];
Array.from({ length: rowspan }).forEach((_, r) => {
const key = tableData?.[rowIndex + r].key;
Array.from({ length: colspan }).forEach((_, c) => {
if (
`${rowIndex}-${columnIndex}-${record.key}` !==
`${rowIndex + r}-${columnIndex + c}-${key}`
) {
spanzero.value[`${rowIndex + r}-${columnIndex + c}-${key}`] = [
0, 0,
];
}
});
if (rowIndex + r < tableData.length) {
const { key } = tableData[rowIndex + r] ?? {};
Array.from({ length: colspan }).forEach((_, c) => {
if (
columnIndex + c < columns.value.length &&
`${rowIndex}-${columnIndex}-${record.key}` !==
`${rowIndex + r}-${columnIndex + c}-${key}`
) {
spanzero.value[`${rowIndex + r}-${columnIndex + c}-${key}`] =
[0, 0];
}
});
}
});
}
});
Expand Down

0 comments on commit ffe1fe9

Please sign in to comment.