Skip to content

Commit

Permalink
优化分页
Browse files Browse the repository at this point in the history
  • Loading branch information
chengzhongxue committed Jun 21, 2024
1 parent 0e32bc6 commit 56245a7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions templates/modules/widgets/paginator.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<a class="extend prev" th:if="${pageInfo.hasPrevious}" rel="prev" th:href="@{${pageInfo.prevUrl}}">
<i class="iconfont icon-arrowleft"></i>
</a>
<th:block th:if="${pageInfo.page > 3}">
<th:block th:if="${pageInfo.page > 2}">
<a class="page-number" th:href="${path+'/page/1'}">1</a>
<span class="page-number" th:if="${pageInfo.page != 4}"></span>
<span class="page-number" th:if="${pageInfo.page != 3}"></span>
</th:block>

<th:block th:each="index:${#numbers.sequence(pageInfo.page-2,pageInfo.page+2)}">
<th:block th:each="index:${#numbers.sequence(pageInfo.page-1,pageInfo.page+1)}">
<span class="page-number current" th:if="${pageInfo.page} == ${index}" th:text="${pageInfo.page}"></span>
<a th:unless="${pageInfo.page == index}" th:if="${index > 0 && index <= pageInfo.totalPages}"
class="page-number" th:href="${path+'/page/'+index}" th:text="${index}"></a>
</th:block>

<th:block th:if="${pageInfo.totalPages - pageInfo.page > 2}">
<span class="page-number" th:if="${pageInfo.totalPages - pageInfo.page != 3}"></span>
<th:block th:if="${pageInfo.totalPages - pageInfo.page >= 2}">
<span class="page-number" th:if="${pageInfo.totalPages - pageInfo.page != 2}"></span>
<a class="page-number" th:href="${path+'/page/'+pageInfo.totalPages}" th:text="${pageInfo.totalPages}"></a>
</th:block>

Expand Down

0 comments on commit 56245a7

Please sign in to comment.