kn-hooks 0.0.35 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -145,14 +145,18 @@ const usePagination=(props)=>{
|
|
|
145
145
|
console.log('[usePagination] response',req)
|
|
146
146
|
let response={};
|
|
147
147
|
if(req?.code==0){
|
|
148
|
-
let {page:{current,
|
|
148
|
+
let {page:{current,total},data:reqData} = req;
|
|
149
|
+
let _pageSize=pageSize;
|
|
150
|
+
// 兼容没数据的时候如果pageSize为0会导致接下来刷新的时候也按0的pageSize来写入
|
|
151
|
+
if(req?.page?.pageSize){
|
|
152
|
+
_pageSize=+req?.page?.pageSize;
|
|
153
|
+
}
|
|
149
154
|
current=+current;
|
|
150
|
-
pageSize=+pageSize;
|
|
151
155
|
total=+total;
|
|
152
|
-
const startIdx= (current-1)*
|
|
153
|
-
const more = current*
|
|
156
|
+
const startIdx= (current-1)*_pageSize;
|
|
157
|
+
const more = current*_pageSize<total;
|
|
154
158
|
response.pagination={
|
|
155
|
-
current,pageSize,total,startIdx,more
|
|
159
|
+
current,pageSize:_pageSize,total,startIdx,more
|
|
156
160
|
};
|
|
157
161
|
setPagination(response.pagination);
|
|
158
162
|
response.data= clear?[]:(data||[]);
|