Skip to content
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

Merged
merged 19 commits into from
Apr 19, 2023
Merged

refactor: pagination #861

merged 19 commits into from
Apr 19, 2023

Conversation

eiinu
Copy link
Member

@eiinu eiinu commented Mar 29, 2023

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、增加受控与非受控方式的单元测试

@oasis-cloud oasis-cloud changed the title feat: Pagination chore: pagination Apr 4, 2023
@oasis-cloud oasis-cloud changed the title chore: pagination refactor: pagination Apr 10, 2023
| 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
Copy link
Collaborator

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) // 当前页
Copy link
Collaborator

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 非受控值
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pagination 组件的 defaultValue 是不是改成 defaultCurrent ,和 current 对应

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

ce5c5446: '基础用法',
c38a08ef: '简单模式',
b840c88f: '显示省略号',
a74a1fd4: '自定义按钮',
Copy link
Collaborator

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) => {
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个demo挺好的

@xiaoyatong xiaoyatong merged commit 6330b5a into jdf2e:next Apr 19, 2023
@eiinu eiinu deleted the v2.0-pagination branch April 20, 2023 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants