我正在将MatBlazor用于我的网站,并且已经通过以下出色的博客实施了Google身份验证:Google Authentication in Server-Side Blazor
我想要MatButton
中的登录按钮(MatAppBar
。
原始代码具有链接:<a class="ml-md-auto btn btn-primary" href="/Login" target="_top">Login</a>
。此链接有效。我被重定向到我的OnGetAsync
的LoginModel
。但这与我的UI风格不匹配。
此按钮确实转到了右页,但是我的OnGetAsync
中的我的LoginModel
未触发,仅显示了默认的Sorry, there's nothing at this address.
。<MatButton Class="mat" Outlined="true" Icon="Google" Label="Inloggen" Link="/Login"></MatButton>
我认为我需要调整路由,但找不到方法。
使用完整网址
<MatButton Class="mat" Outlined="true" Icon="Google" Label="Inloggen"
Link="BaseUrl/Login"></MatButton>
或使用导航管理器浏览该页面
@inject NavigationManager navigationmanager
<MatButton Class="mat" Outlined="true" Icon="Google" Label="Inloggen" Onclick="@(()=>)"></MatButton>
code{
void clic()
{
navigationmanager.Navigateto("/Login")
}
}