Skip to content

Commit

Permalink
fix tab pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Mar 23, 2024
1 parent 1883bc5 commit 3824534
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions MyApp/Components/Pages/Questions/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

@if (total > PageSize)
{
<PagesNav class="border-b" Path=@Path PageSize=@PageSize Total=@total Page=@Math.Max(1, Page ?? 1)/>
<PagesNav class="border-b" Path=@Path Tab=@Tab PageSize=@PageSize Total=@total Page=@Math.Max(1, Page ?? 1)/>
}

<QuestionPosts Posts=@posts/>

@if (total > PageSize)
{
<PagesNav class="border-t" Path=@Path PageSize=@PageSize Total=@total Page=@Math.Max(1, Page ?? 1)/>
<PagesNav class="border-t" Path=@Path Tab=@Tab PageSize=@PageSize Total=@total Page=@Math.Max(1, Page ?? 1)/>
}
}
else
Expand Down
3 changes: 2 additions & 1 deletion MyApp/Components/Shared/PagesNav.razor
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@

[Parameter] public string? @class { get; set; }
[Parameter] public required string Path { get; set; }
[Parameter] public required string? Tab { get; set; }
[Parameter] public required long? Total { get; set; }
[Parameter] public required int? PageSize { get; set; }
[Parameter] public required int Page { get; set; }
Expand All @@ -108,5 +109,5 @@
int EndPage => Math.Min(StartPage + 5, Pages);

public string GetRoute(int? page = 1, int? pageSize = null) =>
Path.AddQueryParam("page", page).AddQueryParam("pagesize", pageSize);
Path.AddQueryParam("tab", Tab).AddQueryParam("page", page).AddQueryParam("pagesize", pageSize);
}

0 comments on commit 3824534

Please sign in to comment.