import{o as s,a,y as n}from"./vue-libs.b44bc779.js";const d={class:"van-doc-markdown-body"},e=n(`

Card

Intro

Used to display product pictures, prices and other information.

Install

Register component globally via app.use, refer to Component Registration for more registration ways.

import { createApp } from 'vue';
import { Card } from 'vant';

const app = createApp();
app.use(Card);

Usage

Basic Usage

<van-card
  num="2"
  price="2.00"
  title="Title"
  desc="Description"
  thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"
/>

Discount Info

<van-card
  num="2"
  tag="Tag"
  price="2.00"
  title="Title"
  desc="Description"
  origin-price="10.00"
  thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"
/>

Custom Content

Use slot to custom content.

<van-card
  num="2"
  title="Title"
  desc="Description"
  price="2.00"
  thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"
>
  <template #tags>
    <van-tag plain type="danger">Tag</van-tag>
    <van-tag plain type="danger">Tag</van-tag>
  </template>
  <template #footer>
    <van-button size="mini">Button</van-button>
    <van-button size="mini">Button</van-button>
  </template>
</van-card>

API

Props

AttributeDescriptionTypeDefault
thumbLeft thumb image URLstring-
titleTitlestring-
descDescriptionstring-
tagTagstring-
numnumbernumber | string-
pricePricenumber | string-
origin-priceOrigin pricenumber | string-
centeredWhether content vertical centeredbooleanfalse
currencyCurrency symbolstring\xA5
thumb-linkThumb link URLstring-
lazy-loadWhether to enable thumb lazy load, should register Lazyload componentbooleanfalse

Events

EventDescriptionArguments
clickEmitted when component is clickedevent: MouseEvent
click-thumbEmitted when thumb is clickedevent: MouseEvent

Slots

NameDescription
titleCustom title
descCustom description
numCustom num
priceCustom price
origin-priceCustom origin price
price-topCustom price top
bottomCustom price bottom
thumbCustom thumb
tagCustom thumb tag
tagsCustom tags
footerCustom footer

Types

The component exports the following type definitions:

import type { CardProps } from 'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-card-paddingvar(--van-padding-xs) var(--van-padding-md)-
--van-card-font-sizevar(--van-font-size-sm)-
--van-card-text-colorvar(--van-text-color)-
--van-card-background-colorvar(--van-gray-1)-
--van-card-thumb-size88px-
--van-card-thumb-border-radiusvar(--van-border-radius-lg)-
--van-card-title-line-height16px-
--van-card-desc-colorvar(--van-gray-7)-
--van-card-desc-line-heightvar(--van-line-height-md)-
--van-card-price-colorvar(--van-gray-8)-
--van-card-origin-price-colorvar(--van-text-color-2)-
--van-card-num-colorvar(--van-text-color-2)-
--van-card-origin-price-font-sizevar(--van-font-size-xs)-
--van-card-price-font-sizevar(--van-font-size-sm)-
--van-card-price-integer-font-sizevar(--van-font-size-lg)-
--van-card-price-font-familyvar(--van-price-integer-font-family)-
`,14),r=[e],h={__name:"README",setup(l,{expose:t}){return t({frontmatter:{}}),(c,o)=>(s(),a("div",d,r))}};export{h as default};