...
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
@inject HttpClient _hc
|
||||
@layout BlogLayout
|
||||
@page "/ListBlog"
|
||||
@page "/ListBlog/{Tag}"
|
||||
@inject NavigationManager Navigation
|
||||
<PageTitle>دانشنامه</PageTitle>
|
||||
<main>
|
||||
@@ -98,6 +99,9 @@
|
||||
</main>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? Tag { get; set; }
|
||||
|
||||
[Parameter,SupplyParameterFromQuery]
|
||||
public int? PageIndex { get; set; }
|
||||
|
||||
@@ -106,7 +110,9 @@
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (PageIndex == null) PageIndex = 1;
|
||||
request = await _hc.GetFromJsonAsync<PagingDto<BlogDto>>($"Base/LastBlog?PageIndex={PageIndex ?? 1}&PageSize=6");
|
||||
string url = $"Base/LastBlog?PageIndex={PageIndex ?? 1}&PageSize=6";
|
||||
if (!string.IsNullOrEmpty(Tag)) url += $" &Tag={Tag}";
|
||||
request = await _hc.GetFromJsonAsync<PagingDto<BlogDto>>(url);
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user