0

我有这个MainLayout.razor

@inherits LayoutComponentBase
@using System.Security.Claims
@inject HelpDesk.Client.Services.Interfaces.IAuthService AuthService

<MudLayout>
    <MudAppBar Elevation="3" Fixed="true">
        <MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
        <MudText Typo="Typo.h5" Class="ml-3">Autosweep Help Desk</MudText>
        <MudSpacer />
        <MudIconButton Icon="@Icons.Material.Filled.MoreVert" Color="Color.Inherit" Edge="Edge.End" />
        <AuthorizeView>
            <MudMenu FullWidth="true" ActivationEvent="@MouseEvent.MouseOver">
                <ActivatorContent>
                    <MudChip Icon="@Icons.Material.Filled.AccountCircle" Color="Color.Warning">@context.User.FindFirst(ClaimTypes.GivenName).Value</MudChip>
                </ActivatorContent>
                <ChildContent>
                    <MudMenuItem @onclick="@(() =>  AuthService.Logout())">
                        Logout
                    </MudMenuItem>
                </ChildContent>
            </MudMenu>
        </AuthorizeView>
    </MudAppBar>
    <MudDrawer ClipMode="DrawerClipMode.Docked" @bind-Open="_drawerOpen" Fixed="true" Color="Color.Success" Elevation="1">
        <MudDrawerHeader>
            <MudText Typo="Typo.h6">Prototyping</MudText>
        </MudDrawerHeader>
        <NavMenu />
    </MudDrawer>
    <MudMainContent>
        @Body
    </MudMainContent>
</MudLayout>

@code {
    bool _drawerOpen = true;

    void DrawerToggle()
    {
        _drawerOpen = !_drawerOpen;


    }
}

<MudThemeProvider />
<MudDialogProvider />
<MudSnackbarProvider /

但是当我的身体很长时,“MudAppBar”不会粘在顶部。

在此处输入图像描述

在此处输入图像描述

4

0 回答 0