yuand
v1.0.14
Published
hyu
Readme
yuand
Protable 对antd. Table + Form的组合 (内部请求使用到 tankQuery 的use-query缓存)
所以需要配置QueryClientProvider
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 1,
refetchOnWindowFocus: false,
},
},
});
<QueryClientProvider client={queryClient}>
<TablePage/>
</QueryClientProvider>
/**
* 例:
* request使用rq请求. from fetch instance
* Protable组件属性继承 antd Table所有属性
* form配置: 继承 antd Form所有属性 内部使用 antd Form进行包裹 form: table.form
*/
function TablePage (){
const [table] = Protable.useTable();
<Protable
table={table}
request={{
url: '/a',
method: 'post',
manual: true,
params: {
a: 1
}
}}
rowKey="id"
dataKey="data"
totalKey="total"
form={{
initialValues: {
displayStatus: "",
sportId: "",
source: "",
},
items: (
<div></div>
),
}}
alert= {<div>统计栏位</div>}
toolbar={<div>操作栏位,新增,添加等</div>}
columns={[
{
title: 'a',
dataIndex: 'a',
}
]}
}
/>LICENSE
MIT
