From 668c678714c72a6c20f30cc1cc28f979983cb1b4 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 29 Sep 2022 12:47:03 +0800 Subject: [PATCH] refactor: pagination component Signed-off-by: Ryan Wang --- .../pagination/Pagination.story.vue | 4 +- .../src/components/pagination/Pagination.vue | 150 ++++++++++-------- .../contents/attachments/AttachmentList.vue | 1 + .../CoreSelectorProvider.vue | 1 + src/modules/contents/comments/CommentList.vue | 1 + src/modules/contents/pages/SinglePageList.vue | 1 + src/modules/contents/posts/PostList.vue | 1 + src/modules/system/users/UserList.vue | 3 +- 8 files changed, 96 insertions(+), 66 deletions(-) diff --git a/packages/components/src/components/pagination/Pagination.story.vue b/packages/components/src/components/pagination/Pagination.story.vue index b9da2ec9..6c351496 100644 --- a/packages/components/src/components/pagination/Pagination.story.vue +++ b/packages/components/src/components/pagination/Pagination.story.vue @@ -2,8 +2,8 @@ diff --git a/packages/components/src/components/pagination/Pagination.vue b/packages/components/src/components/pagination/Pagination.vue index 059ad840..b1cc3a1a 100644 --- a/packages/components/src/components/pagination/Pagination.vue +++ b/packages/components/src/components/pagination/Pagination.vue @@ -1,24 +1,32 @@ diff --git a/src/modules/contents/attachments/AttachmentList.vue b/src/modules/contents/attachments/AttachmentList.vue index ee86f827..a31e5f78 100644 --- a/src/modules/contents/attachments/AttachmentList.vue +++ b/src/modules/contents/attachments/AttachmentList.vue @@ -690,6 +690,7 @@ onMounted(() => { :page="attachments.page" :size="attachments.size" :total="attachments.total" + :size-options="[60, 120, 200]" @change="handlePaginationChange" /> diff --git a/src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue b/src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue index 0be884d5..9ae389a8 100644 --- a/src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue +++ b/src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue @@ -165,6 +165,7 @@ await handleFetchAttachments(); :page="attachments.page" :size="attachments.size" :total="attachments.total" + :size-options="[60, 120, 200]" @change="handlePaginationChange" /> diff --git a/src/modules/contents/comments/CommentList.vue b/src/modules/contents/comments/CommentList.vue index da4e3074..36bf51ab 100644 --- a/src/modules/contents/comments/CommentList.vue +++ b/src/modules/contents/comments/CommentList.vue @@ -428,6 +428,7 @@ function handleSelectUser(user: User | undefined) { :page="comments.page" :size="comments.size" :total="comments.total" + :size-options="[20, 30, 50, 100]" @change="handlePaginationChange" /> diff --git a/src/modules/contents/pages/SinglePageList.vue b/src/modules/contents/pages/SinglePageList.vue index f01d5a5b..1e2c34d6 100644 --- a/src/modules/contents/pages/SinglePageList.vue +++ b/src/modules/contents/pages/SinglePageList.vue @@ -638,6 +638,7 @@ function handleSortItemChange(sortItem?: SortItem) { :page="singlePages.page" :size="singlePages.size" :total="singlePages.total" + :size-options="[20, 30, 50, 100]" @change="handlePaginationChange" /> diff --git a/src/modules/contents/posts/PostList.vue b/src/modules/contents/posts/PostList.vue index 42c6e9a9..db9ccc8a 100644 --- a/src/modules/contents/posts/PostList.vue +++ b/src/modules/contents/posts/PostList.vue @@ -928,6 +928,7 @@ function handleContributorChange(user?: User) { :page="posts.page" :size="posts.size" :total="posts.total" + :size-options="[20, 30, 50, 100]" @change="handlePaginationChange" /> diff --git a/src/modules/system/users/UserList.vue b/src/modules/system/users/UserList.vue index 27821b27..eac34f7c 100644 --- a/src/modules/system/users/UserList.vue +++ b/src/modules/system/users/UserList.vue @@ -36,7 +36,7 @@ const grantPermissionModal = ref(false); const users = ref({ page: 1, - size: 10, + size: 20, total: 0, items: [], first: true, @@ -486,6 +486,7 @@ onMounted(() => { :page="users.page" :size="users.size" :total="users.total" + :size-options="[20, 30, 50, 100]" @change="handlePaginationChange" />