짝수 페이지네이션

This commit is contained in:
leejinseok
2020-02-21 12:27:08 +09:00
parent 8215594e93
commit fb0744f77c
2 changed files with 7 additions and 1 deletions

View File

@@ -96,7 +96,7 @@
const data = await articleService.getArticles({page});
const {content, totalPages, pageable} = data;
this.pages = paginationUtil(page + 1, totalPages);
this.pages = paginationUtil(page + 1, totalPages, 4);
this.articles = content;
this.pending = false;

View File

@@ -15,8 +15,14 @@ export default function (currentPage, totalPage, chapterSize = 5) {
} else {
const rest = (chapterSize - 1);
const halfOfRest = rest / 2;
start = currentPage - halfOfRest;
end = currentPage + halfOfRest;
if (halfOfRest % 2 !== 0) {
start += 0.5;
end += 0.5;
}
}
const range = [];