order: 3 title: 0.x 到 1.0

hide: true

对于之前使用 0.x 的同学,考虑到代码使用合理性,我们对于 TableRender 1.0 有如下更新

  1. table-render 的导出有如下变化,ProTable 修改成 Table

  2. SearchTable不再需要被TableContainer组件包裹,所有表格代码通过 withTable 包一下即可,这样书写更加简洁。

  3. searchApi 原本放到 TableContainer组件上面,现改成放到 Search 上,同时searchApi 改成 api,这样更加各司其职。

    1. // 老版本使用
    2. import { ProTable, Search, TableContainer, useTable } from 'table-render';
    3. //...
    4. const TableDemo=(
    5. <TableContainer searchApi={searchApi}>
    6. <TableDemo />
    7. </TableContainer>
    8. );
    9. const TableBody = (
    10. const { refresh } = useTable();
    11. <>
    12. <Search schema={searchSchema} />
    13. <ProTable />
    14. </>
    15. );
    16. export default TableDemo;
    17. // 新版本
    18. import { Table, Search, withTable, useTable } from 'table-render';
    19. //...
    20. const TableDemo = (
    21. const { refresh } = useTable()
    22. <>
    23. <Search schema={schema} api={searchApi} />
    24. <Table headerTitle="最简表格" columns={columns} rowKey="id" />
    25. </>
    26. );
    27. export default withTable(TableDemo);