Card卡片

用于组织信息和操作,通常也作为详细信息的入口。

规则

  • 形状为矩形。
  • 可包含多种类型的元素,eg:图片、文字、按钮等。

代码演示

默认

Card 默认样式

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'demo-card-basic',
  4. template: `
  5. <WingBlank [size]="'lg'">
  6. <Card>
  7. <CardHeader [title]="'This is title'"
  8. [thumb]="'https://gw.alipayobjects.com/zos/rmsportal/MRhHctKOineMbKAZslML.jpg'"
  9. [thumbStyle]="thumbStyle"
  10. [extra]="extra"
  11. >
  12. <ng-template #extra>
  13. <span>this is extra</span>
  14. </ng-template>
  15. </CardHeader>
  16. <CardBody>
  17. <div>This is content of Card</div>
  18. </CardBody>
  19. <CardFooter [content]="'footer content'" [extra]="footerExtra">
  20. <ng-template #footerExtra>
  21. <div>extra footer content</div>
  22. </ng-template>
  23. </CardFooter>
  24. </Card>
  25. </WingBlank>
  26. `
  27. })
  28. export class DemoCardBasicComponent {
  29. thumbStyle = {
  30. width: '32px',
  31. height: '32px'
  32. };
  33. }

通栏

Card 通栏样式

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'demo-card-full',
  4. template: `
  5. <Card [full]="true">
  6. <CardHeader [title]="'This is title'"
  7. [thumb]="'https://gw.alipayobjects.com/zos/rmsportal/MRhHctKOineMbKAZslML.jpg'"
  8. [thumbStyle]="thumbStyle"
  9. [extra]="extra"
  10. >
  11. <ng-template #extra>
  12. <span>this is extra</span>
  13. </ng-template>
  14. </CardHeader>
  15. <CardBody>
  16. <div>This is content of Card</div>
  17. </CardBody>
  18. <CardFooter [content]="'footer content'" [extra]="footerExtra">
  19. <ng-template #footerExtra>
  20. <div>extra footer content</div>
  21. </ng-template>
  22. </CardFooter>
  23. </Card>
  24. `
  25. })
  26. export class DemoCardFullComponent {
  27. thumbStyle = {
  28. width: '32px',
  29. height: '32px'
  30. };
  31. }

Card 卡片 - 图1

API

Card

属性说明类型默认值
full是否通栏booleanfalse

CardHeader

属性说明类型默认值
title卡片标题TemplateRef、String
thumb卡片标题图片String、TemplateRef
thumbStyle标题图片样式Object{}
extra卡片标题辅助内容TemplateRef、String

CardBody

属性说明类型默认值

CardFooter

属性说明类型默认值
content尾部内容TemplateRef、String
extra尾部辅助内容TemplateRef、String