角度材料可折叠卡

有没有办法用角形材料制作可折叠的卡片?看起来像是相当受欢迎的东西,但我一直在这里寻找合适的角度材料组件/设置: Angular Material – Card并没有发现任何东西.

谢谢!

解决方法

像Will提到的那样,只需使用扩展面板. https://material.angular.io/components/expansion/overview

否则只需创建一个普通的Angular Material卡并使用[hidden]质量或一些CSS(display:none)实现自己的折叠机制.您可以利用* ngIf和按钮事件来创建自己的可折叠卡片.不应该需要太多代码.

像这样的东西:

<mat-card>
  <mat-card-header>
     <mat-card-title style="font-size: 20px;">My collapsible card title</mat-card-title>
  </mat-card-header>

  <mat-card-content *ngIf="!collapsed">
    <p>This is some example text.</p>
     <p>This text will disappear when you use the action button in the actions bar below.</p>
  </mat-card-content>
  <mat-card-actions>
     <button mat-button (click)="collapsed=true">Collapse text</button>
     <button mat-button (click)="collapsed=false">Uncollapse text</button>
  </mat-card-actions>
</mat-card>

Stackblitz:https://stackblitz.com/edit/angular-95ygrr

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...