提交 b36d9486 编写于 作者: V vben

fix(mock): fix mock paging tool error

上级 a1ffb618
......@@ -3,10 +3,15 @@
### ⚡ Performance Improvements
- Layout 界面布局样式调整
- 优化表格渲染性能
- 表单折叠搜索添图标添加动画
### 🐛 Bug Fixes
- 修复表格类型错误
- 修复 mock 分页工具错误
- 修复表格开启搜索表单折叠问题
- 修复表格 size 为 samll 时候,fixed 列样式问题
## 2.0.0-rc.7 (2020-10-31)
......
......@@ -38,8 +38,10 @@ export function resultError(message = 'Request failed', { code = -1, result = nu
}
export function pagination<T = any>(pageNo: number, pageSize: number, array: T[]): T[] {
let offset = (pageNo - 1) * pageSize;
return offset + pageSize >= array.length
? array.slice(offset, array.length)
: array.slice(offset, offset + pageSize);
let offset = (pageNo - 1) * Number(pageSize);
const ret =
offset + Number(pageSize) >= array.length
? array.slice(offset, array.length)
: array.slice(offset, offset + Number(pageSize));
return ret;
}
此差异已折叠。
......@@ -115,7 +115,6 @@ export function useDataSource(
if (afterFetch && isFunction(afterFetch)) {
resultItems = afterFetch(resultItems) || resultItems;
}
dataSourceRef.value = resultItems;
setPagination({
total: resultTotal || 0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册