Card 卡片
该组件提供了比el-card更加易用,便捷的功能
基础用法
卡片标题
暂无数据
查看代码
vue
<template>
<gi-card title="卡片标题" bordered>
<template #extra>
<el-button type="primary">保存</el-button>
<el-button>返回</el-button>
</template>
<el-empty description="暂无数据" />
</gi-card>
</template>内置类名
内置类名提供了卡片标题伪元素样式
卡片标题
暂无数据
查看代码
vue
<template>
<gi-card title="卡片标题" bordered class="gi-card-title">
<template #extra>
<el-button type="primary">保存</el-button>
<el-button>返回</el-button>
</template>
<el-empty description="暂无数据" />
</gi-card>
</template>底部插槽
卡片标题
查看代码
vue
<template>
<gi-card title="卡片标题" bordered class="gi-card-title">
<template #extra>
<el-button type="primary">保存</el-button>
<el-button>返回</el-button>
</template>
<el-space wrap>
<el-button>Default</el-button>
<el-button type="primary">Primary</el-button>
<el-button type="success">Success</el-button>
<el-button type="info">Info</el-button>
<el-button type="warning">Warning</el-button>
<el-button type="danger">Danger</el-button>
</el-space>
<template #footer>
<el-alert title="Customized close text" type="info" close-text="Gotcha" />
</template>
</gi-card>
</template>迷你卡片
卡片标题
查看代码
vue
<template>
<gi-card title="卡片标题" bordered size="small" class="gi-card-title">
<template #extra>
<el-button type="primary" size="small">保存</el-button>
<el-button size="small">返回</el-button>
</template>
<el-space wrap>
<el-button>Default</el-button>
<el-button type="primary">Primary</el-button>
<el-button type="success">Success</el-button>
<el-button type="info">Info</el-button>
<el-button type="warning">Warning</el-button>
<el-button type="danger">Danger</el-button>
</el-space>
<template #footer>
<el-alert title="Customized close text" type="info" close-text="Gotcha" />
</template>
</gi-card>
</template>内容滚动
卡片标题
查看代码
vue
<template>
<gi-card title="卡片标题" bordered style="height: 400px" :body-style="{ overflowY: 'auto' }">
<template #extra>
<el-button type="primary">保存</el-button>
<el-button>返回</el-button>
</template>
<el-space wrap>
<el-button v-for="i in 100" :key="i" type="primary">
按钮{{ i }}
</el-button>
</el-space>
</gi-card>
</template>内嵌模式
卡片标题
内嵌模式消除了左右内边距
查看代码
vue
<template>
<gi-card title="卡片标题" inner>
<template #extra>
<el-button type="primary">保存</el-button>
<el-button>返回</el-button>
</template>
<el-alert title="内嵌模式消除了左右内边距" type="primary" :closable="false" />
</gi-card>
</template>API
Props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 标题 | string | - |
| extra | 卡片右上角的操作区域 | string | - |
| bordered | 是否有边框 | boolean | false |
| size | 尺寸 | samll | middle | middle |
| headerStyle | 卡片头部区域的样式 | CSSProperties | - |
| bodyStyle | 卡片内容区域的样式 | CSSProperties | - |
| inner | 内嵌模式,消除左右内边距 | boolean | false |
Slots
| 名称 | 说明 |
|---|---|
| default | 卡片内容 |
| extra | 卡片右上角的操作区域 |
