Card 卡片

使用指南

在 index.json 中引入组件

"usingComponents": {
  "van-card": "path/to/vant-weapp/dist/card/index"
}

代码演示

基础用法

<van-card
  title="标题"
  desc="描述"
  num="2"
  price="2.00"
  thumb="{{ imageURL }}"
/>

高级用法

可以通过具名slot添加定制内容

<van-card
  title="标题"
  desc="描述"  
  num="2"
  price="2.00"
  thumb="{{ imageURL }}"
  use-footer-slot="{{ true }}"
>
  <div slot="footer">
    <van-button size="mini">按钮</van-button>
    <van-button size="mini">按钮</van-button>
  </div>
</van-card>

API

参数 说明 类型 默认值
thumb 左侧图片 String -
title 标题 String -
desc 描述 String -
num 商品数量 `String Number`
price 商品价格 `String Number`
centered 内容是否垂直居中 String false
currency 货币符号 String ¥
use-desc-slot 是否使用 desc slot Boolean false
use-title-slot 是否使用 title slot Boolean false
use-thumb-slot 是否使用 thumb slot Boolean false
use-footer-slot 是否使用 footer slot Boolean false

Slot

名称 说明
title 自定义标题
desc 自定义描述
tags 自定义 tags
thumb 自定义 thumb
footer 自定义 footer

外部样式类

类名 说明
custom-class 根节点样式类
thumb-class 左侧图片样式类
title-class 标题样式类
price-class 价格样式类
desc-class 描述样式类
num-class 数量样式类