优化Table
parent
5fbd6cee5d
commit
2bebf8499d
|
|
@ -13,9 +13,16 @@ function Table(props) {
|
||||||
} = props;
|
} = props;
|
||||||
function calcColumns() {
|
function calcColumns() {
|
||||||
showIndexColumn && columns.unshift({...getIndexColumn(props.pagination), fixed: indexColumnFixed});
|
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;
|
export default Table;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue