mirror of https://github.com/ElemeFE/element
2.3 KiB
2.3 KiB
Card
Integrate information in a card container.
Basic usage
Card includes title, content and operations.
:::demo Card is made up of header
and body
. header
is optional, and its content distribution depends on a named slot.
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="line-height: 36px;">Card name</span>
<el-button style="float: right;" type="primary">Operation button</el-button>
</div>
<div v-for="o in 4" class="text item">
{{'List item ' + o }}
</div>
</el-card>
:::
Simple card
The header part can be omitted.
:::demo
<el-card class="box-card">
<div v-for="o in 4" class="text item">
{{'List item ' + o }}
</div>
</el-card>
:::
With images
Display richer content by adding some configs.
:::demo The body-style
attribute defines CSS style of custom body
. This example also uses el-col
for layout.
<el-row>
<el-col :span="8" v-for="(o, index) in 2" :offset="index > 0 ? 2 : 0">
<el-card :body-style="{ padding: '0px' }">
<img src="~examples/assets/images/hamburger.png" class="image">
<div style="padding: 14px;">
<span>Yummy hamburger</span>
<div class="bottom clearfix">
<time class="time">{{ currentDate }}</time>
<el-button type="text" class="button">Operating button</el-button>
</div>
</div>
</el-card>
</el-col>
</el-row>
:::
Attributes
Attribute | Description | Type | Accepted Values | Default |
---|---|---|---|---|
header | Title of the card. Also accepts a DOM passed by slot#header |
string | — | — |
body-style | CSS style of body | object | — | { padding: '20px' } |