/*! For license information please see 6900.68f65886.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["6900"],{21451:function(s,n,a){"use strict";a.r(n);var t=a("80681");let e=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'

ContactCard

\n

Intro

\n

Display contact information in the form of cards.

\n

Install

\n

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

\n
import { createApp } from 'vue';\nimport { ContactCard } from 'vant';\n\nconst app = createApp();\napp.use(ContactCard);\n
\n

Usage

\n

Add Contact

\n
<van-contact-card type="add" @click="onAdd" />\n
\n
import { showToast } from 'vant';\n\nexport default {\n  setup() {\n    const onAdd = () => showToast('add');\n    return {\n      onAdd,\n    };\n  },\n};\n
\n

Edit Contact

\n
<van-contact-card type="edit" :tel="tel" :name="name" @click="onEdit" />\n
\n
import { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n  setup() {\n    const tel = ref('13000000000');\n    const name = ref('John Snow');\n    const onEdit = () => showToast('edit');\n\n    return {\n      tel,\n      name,\n      onEdit,\n    };\n  },\n};\n
\n

Uneditable

\n
<van-contact-card\n  type="edit"\n  name="John Snow"\n  tel="13000000000"\n  :editable="false"\n/>\n
\n

API

\n

Props

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
AttributeDescriptionTypeDefault
typeCan be set to editstringadd
nameNamestring-
telPhonestring-
add-textAdd card textstringAdd contact info
editableWhether to allow editing of contactsbooleantrue
\n

Events

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
EventDescriptionArguments
clickEmitted when component is clickedevent: MouseEvent
\n

Types

\n

The component exports the following type definitions:

\n
import type { ContactCardType, ContactCardProps } from 'vant';\n
\n

Theming

\n

CSS Variables

\n

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

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
NameDefault ValueDescription
--van-contact-card-paddingvar(--van-padding-md)-
--van-contact-card-add-icon-size40px-
--van-contact-card-add-icon-colorvar(--van-primary-color)-
--van-contact-card-title-line-heightvar(--van-line-height-md)-
\n
'},null,8,e))}}}]);