我也尝试导航至blazor(.razor)页面的不同部分。浏览了各种帖子,但没有帮助.....
答案 0 :(得分:1)
Please refer the below code snippets
@page "/navigate"
@inject NavigationManager NavigationManager
<h1>Navigate in Code Example</h1>
<button class="btn btn-primary" @onclick="NavigateToCounterComponent">
Navigate to the Counter component
</button>
@code {
private void NavigateToCounterComponent()
{
NavigationManager.NavigateTo("counter");
}
}
链接:https://docs.microsoft.com/en-us/aspnet/core/blazor/routing?view=aspnetcore-3.1
答案 1 :(得分:-1)
对于到祖先的链接,有一个来自DevExpress DevExpress.Blazor.AnchorUtils
的工具您可以定义一个AnchorLink
<AnchorLink class="nav-link py-3 px-4" href="#MySection1">My Section 1</AnchorLink>
有关更多信息,请参见链接。