修复 Tables fixed 不对齐的问题

This commit is contained in:
liaoxuezhi 2019-09-05 12:08:32 +08:00
parent aa05989424
commit 51b631f62d

View File

@ -502,11 +502,11 @@ export default class Table extends React.Component<TableProps, object> {
} = (this.heights = {});
forEach(table.querySelectorAll('thead>tr:last-child>th'), (item: HTMLElement) => {
heights.header || (heights.header = item.offsetHeight);
widths[item.getAttribute('data-index') as string] = item.clientWidth;
widths[item.getAttribute('data-index') as string] = item.offsetWidth;
});
forEach(
table.querySelectorAll('tbody>tr>*:last-child'),
(item: HTMLElement, index: number) => (heights[index] = item.clientHeight)
(item: HTMLElement, index: number) => (heights[index] = item.offsetHeight)
);
// 让 react 去更新非常慢,还是手动更新吧。