kn-hooks 0.0.36 → 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
|
@@ -146,16 +146,17 @@ const usePagination=(props)=>{
|
|
|
146
146
|
let response={};
|
|
147
147
|
if(req?.code==0){
|
|
148
148
|
let {page:{current,total},data:reqData} = req;
|
|
149
|
+
let _pageSize=pageSize;
|
|
149
150
|
// 兼容没数据的时候如果pageSize为0会导致接下来刷新的时候也按0的pageSize来写入
|
|
150
151
|
if(req?.page?.pageSize){
|
|
151
|
-
|
|
152
|
+
_pageSize=+req?.page?.pageSize;
|
|
152
153
|
}
|
|
153
154
|
current=+current;
|
|
154
155
|
total=+total;
|
|
155
|
-
const startIdx= (current-1)*
|
|
156
|
-
const more = current*
|
|
156
|
+
const startIdx= (current-1)*_pageSize;
|
|
157
|
+
const more = current*_pageSize<total;
|
|
157
158
|
response.pagination={
|
|
158
|
-
current,pageSize,total,startIdx,more
|
|
159
|
+
current,pageSize:_pageSize,total,startIdx,more
|
|
159
160
|
};
|
|
160
161
|
setPagination(response.pagination);
|
|
161
162
|
response.data= clear?[]:(data||[]);
|