2019-02-12 09:08:19 +08:00
|
|
|
## Card
|
|
|
|
|
|
|
|
Conteneur intégrant des informations.
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
2019-06-25 10:25:18 +08:00
|
|
|
Le composant Card comprend un titre, un contenu et des opérations.
|
2019-02-12 09:08:19 +08:00
|
|
|
|
|
|
|
:::demo Card est composé d'un `header` et d'un `body`. `header` est optionnel et son contenu nécessite l'utilisation d'un slot.
|
|
|
|
```html
|
|
|
|
<el-card class="box-card">
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
<span>Card name</span>
|
2019-06-25 10:25:18 +08:00
|
|
|
<el-button style="float: right; padding: 3px 0" type="text">Bouton</el-button>
|
2019-02-12 09:08:19 +08:00
|
|
|
</div>
|
|
|
|
<div v-for="o in 4" :key="o" class="text item">
|
|
|
|
{{'List item ' + o }}
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.text {
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.item {
|
|
|
|
margin-bottom: 18px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.clearfix:before,
|
|
|
|
.clearfix:after {
|
|
|
|
display: table;
|
|
|
|
content: "";
|
|
|
|
}
|
|
|
|
.clearfix:after {
|
|
|
|
clear: both
|
|
|
|
}
|
|
|
|
|
|
|
|
.box-card {
|
|
|
|
width: 480px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Card simple
|
|
|
|
|
|
|
|
Le header peut être omis.
|
|
|
|
|
|
|
|
:::demo
|
|
|
|
```html
|
|
|
|
<el-card class="box-card">
|
|
|
|
<div v-for="o in 4" :key="o" class="text item">
|
|
|
|
{{'List item ' + o }}
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.text {
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.item {
|
|
|
|
padding: 18px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.box-card {
|
|
|
|
width: 480px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Images
|
|
|
|
|
|
|
|
Affichez un contenu plus riche grâce à la configuration.
|
|
|
|
|
|
|
|
:::demo L'attribut `body-style` définit le style CSS du `body`. Cet exemple utilise aussi `el-col` pour la mise en page.
|
|
|
|
```html
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8" v-for="(o, index) in 2" :key="o" :offset="index > 0 ? 2 : 0">
|
|
|
|
<el-card :body-style="{ padding: '0px' }">
|
2019-04-03 16:35:04 +08:00
|
|
|
<img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
|
2019-02-12 09:08:19 +08:00
|
|
|
<div style="padding: 14px;">
|
|
|
|
<span>Yummy hamburger</span>
|
|
|
|
<div class="bottom clearfix">
|
|
|
|
<time class="time">{{ currentDate }}</time>
|
2019-03-18 19:41:08 +08:00
|
|
|
<el-button type="text" class="button">Operating</el-button>
|
2019-02-12 09:08:19 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.time {
|
|
|
|
font-size: 13px;
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
|
|
|
|
.bottom {
|
|
|
|
margin-top: 13px;
|
|
|
|
line-height: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.button {
|
|
|
|
padding: 0;
|
|
|
|
float: right;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image {
|
|
|
|
width: 100%;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.clearfix:before,
|
|
|
|
.clearfix:after {
|
|
|
|
display: table;
|
|
|
|
content: "";
|
|
|
|
}
|
|
|
|
|
|
|
|
.clearfix:after {
|
|
|
|
clear: both
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
currentDate: new Date()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Ombres
|
|
|
|
|
|
|
|
Vous pouvez définir quand l'ombre des Cards doivent apparaître.
|
|
|
|
|
|
|
|
:::demo L'attribut `shadow` détermine quand l'ombre doit apparaître. Les valeurs possibles sont `always`, `hover` ou `never`.
|
|
|
|
```html
|
|
|
|
<el-row :gutter="12">
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-card shadow="always">
|
|
|
|
Always
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-card shadow="hover">
|
|
|
|
Hover
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-card shadow="never">
|
|
|
|
Never
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Attributs
|
|
|
|
| Attribut | Description | Type | Valeurs acceptées | Défaut |
|
|
|
|
|---------- |-------- |---------- |------------- |-------- |
|
|
|
|
| header | Titre de la Card. Accepte aussi un template DOM passé via `slot#header`. | string| — | — |
|
|
|
|
| body-style | Style CSS du body. | object| — | { padding: '20px' } |
|
|
|
|
| shadow | Quand l'ombre doit apparaître | string | always / hover / never | always |
|