Merge branch 'release' into 'master'

Release

See merge request yescent/yes.blog!40
This commit is contained in:
2025-05-10 14:25:42 +00:00
2 changed files with 11 additions and 0 deletions

View File

@@ -70,6 +70,14 @@
{% endfor %} {% endfor %}
{% if Model.Comments.HasPreviousPage %}
<a class="enabled current" href="?page={{ Model.Comments.PreviousPage }}">上一页</a>
{% endif %}
{% if Model.Comments.HasNextPage %}
<a class="enabled current" href="?page={{ Model.Comments.NextPage }}">下一页</a>
{% endif %}
</div> </div>
{% endif %} {% endif %}
</section> </section>

View File

@@ -13,6 +13,9 @@
public record PagedList<T>(List<T> Items, int PageIndex, int PageSize, int TotalItems) public record PagedList<T>(List<T> Items, int PageIndex, int PageSize, int TotalItems)
{ {
public bool HasNextPage => PageIndex * PageSize < TotalItems; public bool HasNextPage => PageIndex * PageSize < TotalItems;
public int NextPage => PageIndex + 1;
public int PreviousPage => PageIndex - 1;
public bool HasPreviousPage => PageIndex > 1; public bool HasPreviousPage => PageIndex > 1;
public int TotalPage => (int)Math.Ceiling((double)TotalItems / PageSize); public int TotalPage => (int)Math.Ceiling((double)TotalItems / PageSize);