优化Table

master
LiuJiaNan 2025-11-12 15:45:12 +08:00
parent 6342492443
commit 3ef5cb8e19
1 changed files with 1 additions and 3 deletions

View File

@ -11,13 +11,11 @@ function TablePro(props) {
rowKey = "id", rowKey = "id",
...restProps ...restProps
} = props; } = props;
const storeIndex = props.storeIndex || `${window.process.env.app.antd["ant-prefix"]}_${Math.random().toString(36).substring(2)}`;
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 })); return columns.map(item => ({ align: useAlignCenter ? "center" : "left", ...item }));
} }
return <Table rowKey={rowKey} storeIndex={storeIndex} columns={calcColumns()} {...restProps} />; return <Table rowKey={rowKey} columns={calcColumns()} {...restProps} />;
} }
export default TablePro; export default TablePro;