/*! For license information please see 6635.df47c50a.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["6635"],{77186:function(t,n,s){"use strict";s.r(n);var a=s("80681");let d=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,a.wg)(),(0,a.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
Used to display product pictures, prices and other information.
\nRegister component globally via app.use
, refer to Component Registration for more registration ways.
import { createApp } from 'vue';\nimport { Card } from 'vant';\n\nconst app = createApp();\napp.use(Card);\n
\n<van-card\n num="2"\n price="2.00"\n title="Title"\n desc="Description"\n thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"\n/>\n
\n<van-card\n num="2"\n tag="Tag"\n price="2.00"\n title="Title"\n desc="Description"\n origin-price="10.00"\n thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"\n/>\n
\nUse slot to custom content.
\n<van-card\n num="2"\n title="Title"\n desc="Description"\n price="2.00"\n thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"\n>\n <template #tags>\n <van-tag plain type="primary">Tag</van-tag>\n <van-tag plain type="primary">Tag</van-tag>\n </template>\n <template #footer>\n <van-button size="mini">Button</van-button>\n <van-button size="mini">Button</van-button>\n </template>\n</van-card>\n
\nAttribute | \nDescription | \nType | \nDefault | \n
---|---|---|---|
thumb | \nLeft thumb image URL | \nstring | \n- | \n
title | \nTitle | \nstring | \n- | \n
desc | \nDescription | \nstring | \n- | \n
tag | \nTag | \nstring | \n- | \n
num | \nnumber | \nnumber | string | \n- | \n
price | \nPrice | \nnumber | string | \n- | \n
origin-price | \nOrigin price | \nnumber | string | \n- | \n
centered | \nWhether content vertical centered | \nboolean | \nfalse | \n
currency | \nCurrency symbol | \nstring | \n\xa5 | \n
thumb-link | \nThumb link URL | \nstring | \n- | \n
lazy-load | \nWhether to enable thumb lazy load, should register Lazyload component | \nboolean | \nfalse | \n
Event | \nDescription | \nArguments | \n
---|---|---|
click | \nEmitted when component is clicked | \nevent: MouseEvent | \n
click-thumb | \nEmitted when thumb is clicked | \nevent: MouseEvent | \n
Name | \nDescription | \n
---|---|
title | \nCustom title | \n
desc | \nCustom description | \n
num | \nCustom num | \n
price | \nCustom price | \n
origin-price | \nCustom origin price | \n
price-top | \nCustom price top | \n
bottom | \nCustom price bottom | \n
thumb | \nCustom thumb | \n
tag | \nCustom thumb tag | \n
tags | \nCustom tags | \n
footer | \nCustom footer | \n
The component exports the following type definitions:
\nimport type { CardProps } from 'vant';\n
\nThe component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.
\nName | \nDefault Value | \nDescription | \n
---|---|---|
--van-card-padding | \nvar(--van-padding-xs) var(--van-padding-md) | \n- | \n
--van-card-font-size | \nvar(--van-font-size-sm) | \n- | \n
--van-card-text-color | \nvar(--van-text-color) | \n- | \n
--van-card-background | \nvar(--van-background) | \n- | \n
--van-card-thumb-size | \n88px | \n- | \n
--van-card-thumb-radius | \nvar(--van-radius-lg) | \n- | \n
--van-card-title-line-height | \n16px | \n- | \n
--van-card-desc-color | \nvar(--van-text-color-2) | \n- | \n
--van-card-desc-line-height | \nvar(--van-line-height-md) | \n- | \n
--van-card-price-color | \nvar(--van-text-color) | \n- | \n
--van-card-origin-price-color | \nvar(--van-text-color-2) | \n- | \n
--van-card-num-color | \nvar(--van-text-color-2) | \n- | \n
--van-card-origin-price-font-size | \nvar(--van-font-size-xs) | \n- | \n
--van-card-price-font-size | \nvar(--van-font-size-sm) | \n- | \n
--van-card-price-integer-font-size | \nvar(--van-font-size-lg) | \n- | \n
--van-card-price-font | \nvar(--van-price-font) | \n- | \n