짝수 페이지네이션
This commit is contained in:
@@ -96,7 +96,7 @@
|
|||||||
const data = await articleService.getArticles({page});
|
const data = await articleService.getArticles({page});
|
||||||
const {content, totalPages, pageable} = data;
|
const {content, totalPages, pageable} = data;
|
||||||
|
|
||||||
this.pages = paginationUtil(page + 1, totalPages);
|
this.pages = paginationUtil(page + 1, totalPages, 4);
|
||||||
|
|
||||||
this.articles = content;
|
this.articles = content;
|
||||||
this.pending = false;
|
this.pending = false;
|
||||||
|
|||||||
@@ -15,8 +15,14 @@ export default function (currentPage, totalPage, chapterSize = 5) {
|
|||||||
} else {
|
} else {
|
||||||
const rest = (chapterSize - 1);
|
const rest = (chapterSize - 1);
|
||||||
const halfOfRest = rest / 2;
|
const halfOfRest = rest / 2;
|
||||||
|
|
||||||
start = currentPage - halfOfRest;
|
start = currentPage - halfOfRest;
|
||||||
end = currentPage + halfOfRest;
|
end = currentPage + halfOfRest;
|
||||||
|
|
||||||
|
if (halfOfRest % 2 !== 0) {
|
||||||
|
start += 0.5;
|
||||||
|
end += 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const range = [];
|
const range = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user