You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constdefaultTransformer=(res: Awaited<ReturnType<A>>)=>{const{ list =[], page =1, size =10, total =0}=res.data||{};// Ensure that the size is greater than 0, If it is less than 0, it will cause paging calculation errors.constpageSize=size<=0 ? 10 : size;constrecordsWithIndex=list.map((item,index)=>{return{
...item,index: (page-1)*pageSize+index+1};});return{data: recordsWithIndex,pageNum: page,
pageSize,
total
};};
给useHookTable传入:
transformer: transformer||defaultTransformer
替代方案
No response
额外的上下文
No response
The text was updated successfully, but these errors were encountered:
描述
useTable函数支持传入transformer,未传入时使用defaultTransformer,增强该hook的扩展性
建议的解决方案
useTable的签名更改为:
提供默认的转换函数:
给useHookTable传入:
替代方案
No response
额外的上下文
No response
The text was updated successfully, but these errors were encountered: