2017-11-06 19:22:02 +08:00
|
|
|
## Card
|
2017-11-08 14:22:51 +08:00
|
|
|
Muestra información dentro de un contenedor `card`
|
2017-11-06 19:22:02 +08:00
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
### Uso Basico
|
2017-11-06 19:22:02 +08:00
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
`Card` incluye titulo, contenido y operaciones.
|
|
|
|
|
|
|
|
:::demo Card se compone de cabecera y cuerpo. La cabecera es opcional y la colocación de su contenido depende de un slot con nombre.
|
2017-11-06 19:22:02 +08:00
|
|
|
|
|
|
|
```html
|
|
|
|
<el-card class="box-card">
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
<span>Card name</span>
|
|
|
|
<el-button style="float: right; padding: 3px 0" type="text">Operation button</el-button>
|
|
|
|
</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>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
### Card simple
|
2017-11-06 19:22:02 +08:00
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
La parte de la cabecera puede omitirse.
|
2017-11-06 19:22:02 +08:00
|
|
|
|
|
|
|
:::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>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
### Con imágenes
|
|
|
|
|
|
|
|
Muestre un contenido más rico añadiendo algunas configuraciones.
|
2017-11-06 19:22:02 +08:00
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
:::demo El atributo `body-style` define el estilo CSS del `body` personalizado. Este ejemplo también utiliza `el-col` para el layout.
|
2017-11-06 19:22:02 +08:00
|
|
|
|
|
|
|
```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">
|
2017-11-06 19:22:02 +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>
|
2017-11-06 19:22:02 +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>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
2018-03-29 15:18:31 +08:00
|
|
|
### Shadow
|
|
|
|
|
2018-05-21 10:46:05 +08:00
|
|
|
Puede definir cuándo mostrar las sombras.
|
|
|
|
|
|
|
|
:::demo El atributo de sombra determina cuándo se muestran las sombras. Puede ser `always`, `hover` o `never`.
|
2018-03-29 15:18:31 +08:00
|
|
|
|
|
|
|
```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
|
2018-03-29 16:28:37 +08:00
|
|
|
</el-card>
|
2018-03-29 15:18:31 +08:00
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
```
|
|
|
|
:::
|
|
|
|
|
2017-11-08 14:22:51 +08:00
|
|
|
### Atributos
|
2018-03-29 15:18:31 +08:00
|
|
|
| Atributo | Descripción | Tipo | Valores aceptados | Por defecto |
|
|
|
|
| ---------- | ---------------------------------------- | ------ | ----------------- | ------------------- |
|
|
|
|
| header | Titulo del card. También acepta DOM pasado por `slot#header` | string | — | — |
|
|
|
|
| body-style | Estilo CSS del cuerpo | object | — | { padding: '20px' } |
|
2018-04-05 20:07:03 +08:00
|
|
|
| shadow | cuando mostrar la sombra del Card | string | always / hover / never | always |
|