-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: pagination #861
refactor: pagination #861
Conversation
src/packages/pagination/doc.en-US.md
Outdated
| pageSize | records per page | string \| number | `10` | | ||
| itemSize | number of pages displayed | string \| number | `5` | | ||
| ellipse | Whether to show ellipsis | boolean | `false` | | ||
| itemRender | Used to customize page number content | (page) => ReactNode | - | | ||
|
||
### Events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和 props 合并~
@@ -75,7 +69,7 @@ export const Pagination: FunctionComponent< | |||
if (mode === 'simple') return [] | |||
const items = [] | |||
const pageCount = _countRef || countRef // 总的页面数量 | |||
const pageSize = Number(showPageSize) // 展示的页面个数 | |||
const pageSize = Number(itemSize) // 展示的页面个数 | |||
const _current = _currentPage || Number(currentPage) // 当前页 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current 的命名是否可以去掉,另Number(),是否不需要,currentPage 默认是否为 number类型了?
@@ -40,6 +40,16 @@ | |||
#### Menu | |||
#### NavBar | |||
#### Pagination | |||
- modelValue 改为 current,受控值 | |||
- 增加 defaultValue 非受控值 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pagination 组件的 defaultValue 是不是改成 defaultCurrent ,和 current 对应
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ce5c5446: '基础用法', | ||
c38a08ef: '简单模式', | ||
b840c88f: '显示省略号', | ||
a74a1fd4: '自定义按钮', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改完挺好,但是为啥要改呢。。
const c = v | ||
setCurrent1(c) | ||
} | ||
const pageChange2 = (v: any) => { | ||
const pageChange2 = (v: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个为啥不加 console 了呢。。
</Cell> | ||
<h2>{translated.uncontrolled}</h2> | ||
<Cell> | ||
<Pagination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个demo挺好的
1、modelValue -> current,受控
2、defaultValue 非受控,增加 demo
3、prevText -> prev
4、nextText -> next
5、forceEllipses -> ellipse
6、showPageSize -> itemSize
7、itemsPerpage -> pageSize
8、totalitems -> total
9、pageNodeRender -> itemRender
10、移除 pageCount
11、增加受控与非受控方式的单元测试