【发布时间】:2019-06-15 15:18:57
【问题描述】:
您好,如何通过参数重定向到Blazor 中的另一个页面?
@page "/auth"
@using Microsoft.AspNetCore.Blazor.Services;
@inject AuthService auth
@inject IUriHelper urihelper;
<input type="text" bind="@Username" />
<button onclick="@AuthAsync">Authenticate</button>
@functions{
public string Username { get; set; }
public string url = "/home";
public async Task AuthAsync()
{
var ticket=await this.auth.AuthenticateAsync(Username);
urihelper.NavigateTo(url); //i see no overload that accepts parameters
}
}
在这种情况下,我想导航到/home 页面,并为其提供一个字符串作为参数。
【问题讨论】: