0

我想将 MatAppBar 与 MatDrawer 一起使用。问题是 MatDrawer 在应用栏上滚动。如何让它在 AppBar 后面滚动?

MatAppBar 与 MatDrawer 的屏幕截图

<MatAppBarContainer >
<MatAppBar Fixed="true">
    <MatAppBarRow>
        <MatAppBarSection>
            <MatIconButton Icon="menu" OnClick="@((e) => ButtonClicked())"></MatIconButton>
            <MatAppBarTitle>MatBlazor - Material Design components for Blazor</MatAppBarTitle>
        </MatAppBarSection>
        <MatAppBarSection Align="@MatAppBarSectionAlign.End">
            <MatIconButton Icon="favorite"></MatIconButton>
        </MatAppBarSection>
    </MatAppBarRow>
</MatAppBar>
<MatAppBarContent>
    <MatDrawerContainer Style="width: 100%; height: 100vh;">
        <MatDrawer @bind-Opened="@Opened" Style="background-color: whitesmoke">
            <MatNavMenu>
                <MatNavItem OnClick="ClickMe" Title="Item 1">Item 1 - OnClick</MatNavItem>
                <MatNavItem Disabled="true" Title="Item 2">Item 2</MatNavItem>
            </MatNavMenu>
        </MatDrawer>
        <MatDrawerContent>
            <div>
                <p>page content</p>
            </div>
        </MatDrawerContent>
    </MatDrawerContainer>
</MatAppBarContent>
4

1 回答 1

0

我在这里更改了代码并收到了结果

<MatAppBarContainer Style="width: 100vw; height: 100vh;">
<MatAppBar>    
    <MatAppBarRow>
        <MatAppBarSection>
            <MatIconButton Icon="menu" OnClick="@((e) => ButtonClicked())" Style="box-shadow:none; outline:none"></MatIconButton>
            <MatAppBarTitle>MatBlazor - Material Design components for Blazor</MatAppBarTitle>
        </MatAppBarSection>
        <MatAppBarSection Align="@MatAppBarSectionAlign.End">
            <MatIconButton Style="box-shadow:none; outline:none" Icon="favorite"></MatIconButton>
        </MatAppBarSection>
    </MatAppBarRow>
</MatAppBar>
<MatAppBarContent>
    <MatDrawerContainer Style="width: 100vw; height: 100%;">
        <MatDrawer @bind-Opened="@Opened" Style="background-color: whitesmoke">
            <MatNavMenu>
                <MatNavItem OnClick="ClickMe" Title="Item 1">Item 1 - OnClick</MatNavItem>
                <MatNavItem Disabled="true" Title="Item 2">Item 2</MatNavItem>                    
            </MatNavMenu>
        </MatDrawer>
        <MatDrawerContent>
            <div>
                <p>page content</p>
            </div>
        </MatDrawerContent>
    </MatDrawerContainer>
</MatAppBarContent>

结果

于 2020-12-28T20:05:35.120 回答