ant-design-blazor/src/AntDesign.Components.Authentication
2023-01-31 23:52:15 +08:00
..
AntDesign.Components.Authentication.csproj docs: update document content 2022-05-29 19:34:54 +08:00
AttributeAuthorizeDataCache.cs feat(module: tabs): Add AuthorizeReuseTabsRouteView (#1910) 2021-10-11 23:01:27 +08:00
AuthorizeReuseTabsRouteView.cs fix(module: tabs): reusetabs keep obsoleted usage (#3051) 2023-01-31 23:52:15 +08:00
README.md feat(module: tabs): Add AuthorizeReuseTabsRouteView (#1910) 2021-10-11 23:01:27 +08:00

AuthorizeReuseTabsRouteView

A combination of ReuseTabsRouteView and AuthorizeRouteView.

How to use

Almost the same as AuthorizeRouteView.

  1. Modify the App.razor file, replace the RouteView or ReuseTabsRouteView with AuthorizeReuseTabsRouteView.

    +<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>
    
  2. Then modify the MainLayout.razor file, add the ReuseTabs 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