<div class="panel">
<div class="panel-body">
<div th:if="${#lists.isEmpty(pagination.data)}">
<h4>搜索条件: <strong th:text="${title}" class="text-info"></strong> 暂无匹配的结果。</h4>
</div>
<div class="media" th:each="article:${pagination.data}">
<div class="media-body">
<div class="media-body">
<h4 class="media-heading">
<a th:href="@{'/article/detail/'+ ${article.id}}" th:utext="${article.title}"></a>
</h4>
<p class="text-desc">
<span th:text="${article.commentCount}"></span> 次回复 •
发表时间: <span th:text=" ${#dates.format(article.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span>
</p>
</div>
</div>
</div>
<nav aria-label="Page navigation" th:if="${!#lists.isEmpty(pagination.data)}">
<ul class="pagination">
<!-- 首页 -->
<li th:if="${!pagination.isFirstPage()}">
<a th:href="@{/search(page=1, title=${title})}" aria-label="Previous" class="page-item">
<span aria-hidden="true">首页</span>
</a>
</li>
<!-- 上一页 -->
<li th:if="${pagination.hasPrevious}">
<a th:href="@{/search(page=${pagination.currentPage - 1}, title=${title})}" class="page-item"
aria-label="Previous">
<span aria-hidden="true">上一页</span>
</a>
</li>
<!-- 遍历页码范围 -->
<li th:each="page : ${pagination.pageNums}"
th:class="${page == pagination.currentPage} ? 'active':'' ">
<a th:href="@{/search(page=${page}, title=${title})}" th:text="${page}" class="page-item"></a>
</li>
<!-- 下一页 -->
<li th:if="${pagination.hasNext}">
<a th:href="@{/search(page=${pagination.currentPage + 1 }, title=${title})}" class="page-item"
aria-label="Previous">
<span aria-hidden="true">下一页</span>
</a>
</li>
<!-- 尾页 -->
<li th:if="${!pagination.isLastPage()}">
<a th:href="@{/search(page=${pagination.totalPage}, title=${title})}" class="page-item"
aria-label="Previous">
<span aria-hidden="true">尾页</span>
</a>
</li>
</ul>
</nav>
</div>
</div>