Card 卡片 APP
该方法或组件支持移动端小程序调用
PC
该方法或组件支持桌面端小程序调用

用于组织信息和操作,通常也作为详细信息的入口。

规则

  • 形状为矩形。
  • 可包含多种类型的元素,eg:图片、文字、按钮等。

引入方式

数字生活小程序工程中,不需要 import,直接使用组件标签即可。

import { Card } from '@21cnfe/vui'  
Vue.component('Card', Card)

代码演示

基本用法 包含标题,内容和操作
<template>
<Card :header="header" :footer="footer">
<div slot="body">这是card body</div>
</Card>
</template>
<script>
export default {
data () {
return {
header: {
content: 'header content',
extra: 'header extra'
},
footer: {
content: 'footer content',
extra: 'footer extra'
}
}
}
}
</script>
设置通栏
<Card full :header="header" :footer="footer">
<div slot="body">这是card body</div>
</Card>
使用插槽
<Card full>
<div slot="header">
<img src="../assets/logo.png" style="height: 20px; width: 20px; padding: 5px">
<span>这是card header</span>
</div>
<div slot="body">这是card body</div>
<div slot="footer">这是card footer</div>
</Card>

API

属性 说明 类型 默认值
full 是否通栏 Boolean false
header 使用传入数据方式设置卡片header Object(对象属性为 contentextra --
footer 使用传入数据方式设置卡片footer Object(对象属性为 contentextra --
content 卡片标题内容 String --
extra 卡片辅助内容 String --

Slot

插槽名称 说明
header 自定义card header
body 自定义card body
footer 自定义card footer
  1. 1. Card 卡片 APP 该方法或组件支持移动端小程序调用 PC 该方法或组件支持桌面端小程序调用
    1. 1.1. 规则
    2. 1.2. 引入方式
    3. 1.3. 代码演示
    4. 1.4. API
    5. 1.5. Slot