mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-12 11:55:24 +08:00
.. | ||
AntDesign.Components.Authentication.csproj | ||
AttributeAuthorizeDataCache.cs | ||
AuthorizeReuseTabsRouteView.cs | ||
README.md |
AuthorizeReuseTabsRouteView
A combination of ReuseTabsRouteView
and AuthorizeRouteView
.
How to use
Almost the same as AuthorizeRouteView
.
-
Modify the
App.razor
file, replace theRouteView
orReuseTabsRouteView
withAuthorizeReuseTabsRouteView
.+<CascadingAuthenticationState> <Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true"> <Found Context="routeData"> - <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> + <AuthorizeReuseTabsRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"> + <NotAuthorized> + <RedirectToLogin /> + </NotAuthorized> + <Authorizing> + <p>Authorizing............</p> + </Authorizing> + </AuthorizeReuseTabsRouteView> </Found> <NotFound> <LayoutView Layout="@typeof(MainLayout)"> <p>Sorry, there's nothing at this address.</p> </LayoutView> </NotFound> </Router> +</CascadingAuthenticationState>
-
Then modify the
MainLayout.razor
file, add theReuseTabs
component. Note that@Body
is required at this case, so you can perform redirect and other actions.@inherits LayoutComponentBase <div class="page"> <div class="sidebar"> <NavMenu /> </div> <div class="main"> - <div class="top-row px-4"> - <a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a> - </div> <div class="content px-4"> @Body </div> + <ReuseTabs Class="top-row px-4" TabPaneClass="content px-4" / > </div> </div>
Customize tab title
Same as ReuseTabsRouteView