【问题标题】:How to create mega menu on Angular material 7如何在 Angular 材质 7 上创建大型菜单
【发布时间】:2019-04-14 18:24:09
【问题描述】:

我使用下面的代码使用 Angular Material 7 创建了工具栏和菜单。我需要在 Angular Material 中创建一个大型菜单。

<mat-toolbar color="primary" class="example-toolbar">
    <mat-toolbar-row style="height: 28px !important;">
            <div class="div-center">
                <button mat-flat-button color="primary" [matMenuTriggerFor]="menu">
                    <mat-icon>directions_car</mat-icon>
                    Cars
                </button>
                <mat-menu #menu="matMenu">
                    <button mat-menu-item>Item 1</button>
                    <button mat-menu-item>Item 2</button>
                </mat-menu>
            </div>
        </mat-toolbar-row>
</mat-toolbar>

我正在寻找这样的大型菜单 https://mdbootstrap.com/docs/jquery/navigation/mega-menu/

谁能知道我怎样才能创建像上面这样的超级菜单。

【问题讨论】:

    标签: angular angular-material mdbootstrap


    【解决方案1】:

    您需要稍微调整一下 mat-menu 组件并构建自己的组件来制作大型菜单组件。

    否则无法直接使用材质进行配置。

    SIMPLE DEMO

    【解决方案2】:

    Angular 2 Material Customize md-menu

    .mat-menu-panel .custom {
      background-color: darkgrey;
      border-radius: 0px;
    }
    

    https://github.com/angular/material2/issues/10322

    【讨论】:

      猜你喜欢
      • 2019-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-12
      • 2019-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多