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
  8. [title]="'This is title'"
  9. [extra]="extra"
  10. [thumb]="'https://gw.alipayobjects.com/zos/rmsportal/MRhHctKOineMbKAZslML.jpg'"
  11. [thumbStyle]="thumbStyle"
  12. >
  13. <ng-template #extra>
  14. <span>this is extra</span>
  15. </ng-template>
  16. </CardHeader>
  17. <CardBody>
  18. <div>This is content of Card</div>
  19. </CardBody>
  20. <CardFooter [content]="'footer content'" [extra]="footerExtra">
  21. <ng-template #footerExtra>
  22. <div>extra footer content</div>
  23. </ng-template>
  24. </CardFooter>
  25. </Card>
  26. </WingBlank>
  27. `
  28. })
  29. export class DemoCardBasicComponent {
  30. thumbStyle = {
  31. width: '32px',
  32. height: '32px'
  33. };
  34. }

通栏

Card 通栏样式

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'demo-card-full',
  4. template: `
  5. <Card [full]="true">
  6. <CardHeader
  7. [title]="'This is title'"
  8. [extra]="extra"
  9. [thumb]="'https://gw.alipayobjects.com/zos/rmsportal/MRhHctKOineMbKAZslML.jpg'"
  10. [thumbStyle]="thumbStyle"
  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. `
  26. })
  27. export class DemoCardFullComponent {
  28. thumbStyle = {
  29. width: '32px',
  30. height: '32px'
  31. };
  32. }

Card卡片 - 图1

API

Card

参数说明类型默认值
[full]是否通栏booleanfalse

CardHeader

参数说明类型默认值
[title]卡片标题string | TemplateRef-
[thumb]卡片标题图片string | TemplateRef-
[thumbStyle]标题图片样式object{}
[extra]卡片标题辅助内容string | TemplateRef-

CardFooter

参数说明类型默认值
[content]尾部内容string | TemplateRef-
[extra]尾部辅助内容string | TemplateRef-