Skip to content

Commit

Permalink
🔨 分页模块开发优化
Browse files Browse the repository at this point in the history
  • Loading branch information
dhjddcn committed Feb 25, 2023
1 parent 2178fd8 commit 7940e94
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions templates/modules/public.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,26 @@ <h1 class="aside-title">
</ul>

<!--分页-->
<div xmlns:th="https://www.thymeleaf.org" th:fragment="pagination(ps,path)" class="pagination text-center"
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="pagination(ps,path)" class="pagination text-center"
th:with="p=${T(java.lang.Math).ceil(T(java.lang.Double).parseDouble(ps.page) / 5.0) },start = ${(p * 5) - 5 +1 },end=${p * 5}">

<a th:if="${ps.hasPrevious()}"
th:href="${ps.prevUrl}"
rel="prev"
title="上一页"
class="prev inline-flex flex-justify-content-center flex-align-items-center">
<i class="fas fa-chevron-left fa-fw"></i>
</a>
<th:block th:if="${ps.totalPages > 5}">

<th:block th:if="${ps.totalPages > 5}">
<a
th:each="index : ${#numbers.sequence(start,end)}"
th:class="${ps.page == index ? 'page current': 'page'}+' inline-flex flex-justify-content-center flex-align-items-center'"
th:href="@{${path+'/page/'} + ${index}}" th:text="${index}"></a>
</th:block>

<th:block th:unless="${ps.totalPages > 5}">
<th:block th:unless="${ps.totalPages > 5}">
<a
th:each="index : ${#numbers.sequence(start,ps.totalPages)}"
th:class="${ps.page == index ? 'page current': 'page'}+' inline-flex flex-justify-content-center flex-align-items-center'"
Expand Down

0 comments on commit 7940e94

Please sign in to comment.