优化Table

master
LiuJiaNan 2025-11-13 17:45:55 +08:00
parent 5fbd6cee5d
commit 2bebf8499d
1 changed files with 9 additions and 2 deletions

View File

@ -13,9 +13,16 @@ function Table(props) {
} = props;
function calcColumns() {
showIndexColumn && columns.unshift({...getIndexColumn(props.pagination), fixed: indexColumnFixed});
return columns.map(item => ({ align: useAlignCenter ? "center" : "left", ...item }));
const setAlign = (column) => ({
...column,
align: useAlignCenter ? "center" : "left",
...(column.children ? { children: column.children.map(setAlign) } : {})
});
return columns.map(setAlign);
}
return <TablePro rowKey={rowKey} columns={calcColumns()} {...restProps} />;
return <TablePro rowKey={rowKey} columns={calcColumns()} bordered {...restProps} />;
}
export default Table;