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

ContactEdit

Intro

Edit and save the contact information.

Install

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

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

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

Usage

Basic Usage

<van-contact-edit
  is-edit
  show-set-default
  :contact-info="editingContact"
  set-default-label="Set as the default contact"
  @save="onSave"
  @delete="onDelete"
/>
import { ref } from 'vue';
import { Toast } from 'vant';

export default {
  setup() {
    const editingContact = ref({
      tel: '',
      name: '',
    });
    const onSave = (contactInfo) => Toast('Save');
    const onDelete = (contactInfo) => Toast('Delete');
    return {
      onSave,
      onDelete,
      editingContact,
    };
  },
};

API

Props

AttributeDescriptionTypeDefault
contact-infoContact InfoContact[]
is-editWhether is editingbooleanfalse
is-savingWhether to show save button loading statusbooleanfalse
is-deletingWhether to show delete button loading statusbooleanfalse
tel-validatorThe method to validate tel(tel: string) => boolean-
show-set-defaultWhether to show default contact switchbooleanfalse
set-default-labeldefault contact switch labelstring-

Events

EventDescriptionArguments
saveEmitted when the save button is clickedcontent: contact info
deleteEmitted when the delete button is clickedcontent: contact info

Data Structure of Contact

keyDescriptionType
nameNamestring
telPhonestring

Types

The component exports the following type definitions:

import type { ContactEditInfo, ContactEditProps } 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-contact-edit-paddingvar(--van-padding-md)-
--van-contact-edit-fields-radiusvar(--van-border-radius-md)-
--van-contact-edit-buttons-paddingvar(--van-padding-xl) 0-
--van-contact-edit-button-margin-bottomvar(--van-padding-sm)-
--van-contact-edit-button-font-sizevar(--van-font-size-lg)-
--van-contact-edit-field-label-width4.1em-
`,12),l=[d],h={__name:"README",setup(o,{expose:t}){return t({frontmatter:{}}),(r,i)=>(s(),a("div",e,l))}};export{h as default};