1
oppddd OP react-query 的请求方式
```tsx const { data, isLoading, refetch } = useQuery(['org-user-table', orgId, query], { queryFn: () => { return queryUserListUsingPOST({ size: query.pageSize || 20, current: query.current || 1, byCondition: { name: query.name, orgId: Number(orgId) || 0, state: query.state || '', }, }) }, }) ``` ```tsx <ProTable // 请注意修改主键 id rowKey={'roleId'} columns={columns} pagination={{ pageSize: 10, showQuickJumper: true }} request={ // 这里发起请求 () => { return Promise() } }> </ProTable> ``` 这两个怎么配合啊,因为 ant 官方推荐使用 request 请求(会自己管理请求参数,分页等); |
2
Sendya 2023-03-02 23:51:05 +08:00
类似这样
```tsx <ProTable rowKey={'roleId'} columns={columns} request={async (params, sorter) => { const { data, total = 0 } = await queryUserListUsingPOST(params); return { data, totla, success: true, } }} /> ``` |
3
oppddd OP 嗯,我其实想让 table 变成木偶组件;这样我就可以使用 react-query 了
|
4
LOWINC 2023-03-09 09:44:52 +08:00
|