【问题标题】:how to fix mat-expansion-panel auto collapse within mat-select?如何修复 mat-select 中的 mat-expansion-panel 自动折叠?
【发布时间】:2020-09-24 11:01:32
【问题描述】:

我在 mat-select 中使用 mat-expansion-panel。 第一次打开mat-select,没关系。但是当我点击退出mat-select 关闭mat-select 然后点击mat-select 第二次重新打开它,我的mat-expansion-panel 已关闭,我必须双击打开它,但不能单击重新打开mat-expansion-panel。 你能帮助我吗?谢谢!

<mat-select multiple [formControl]="formControl">
 <mat-expansion-panel *ngFor="let group of groups" [expanded]="true">
                <mat-expansion-panel-header>
                    <mat-panel-title title="{{group.name}}">
                        <mat-checkbox (click)="toggleGroupParent($event, group.name, group.selected)" [(ngModel)]="group.selected" >
                            {{group.name}}
                        </mat-checkbox>
                    </mat-panel-title>
                </mat-expansion-panel-header>
                <ng-container *ngFor="let item of items">
                    <mat-option *ngIf="item.type == group.name" [value]="item" (click)="togglePerOneInType(group.name)" title="{{item.text}}">
                        {{item.text}}
                    </mat-option>
                </ng-container>
            </mat-expansion-panel>
</mat-select>

【问题讨论】:

    标签: html angular angular-material angular-material2 mat-expansion-panel


    【解决方案1】:

    添加这个

    <mat-panel-title   (click)="$event.stopPropagation();">
    

    【讨论】:

    • 如果您要求朋友/同事为您的帖子投票,请不要
    猜你喜欢
    • 2019-07-12
    • 2018-07-04
    • 1970-01-01
    • 2019-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-09
    相关资源
    最近更新 更多