Skip to content

Commit

Permalink
fix(mock): fix mock paging tool error
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Nov 1, 2020
1 parent a1ffb61 commit b36d948
Show file tree
Hide file tree
Showing 4 changed files with 867 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
### ⚡ Performance Improvements

- Layout 界面布局样式调整
- 优化表格渲染性能
- 表单折叠搜索添图标添加动画

### 🐛 Bug Fixes

- 修复表格类型错误
- 修复 mock 分页工具错误
- 修复表格开启搜索表单折叠问题
- 修复表格 size 为 samll 时候,fixed 列样式问题

## 2.0.0-rc.7 (2020-10-31)

Expand Down
10 changes: 6 additions & 4 deletions mock/_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading

0 comments on commit b36d948

Please sign in to comment.