mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-09-22 11:29:56 +08:00
53 lines
957 B
Vue
53 lines
957 B
Vue
<template>
|
|
<demo-block :title="t('basicUsage')">
|
|
<van-contact-edit
|
|
is-edit
|
|
show-set-default
|
|
:contact-info="editingContact"
|
|
:set-default-label="t('defaultLabel')"
|
|
@save="onSave"
|
|
@delete="onDelete"
|
|
/>
|
|
</demo-block>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { ref } from 'vue';
|
|
import { useTranslate } from '@demo/use-translate';
|
|
import { Toast } from '../../toast';
|
|
|
|
const i18n = {
|
|
'zh-CN': {
|
|
defaultLabel: '设为默认联系人',
|
|
},
|
|
'en-US': {
|
|
defaultLabel: 'Set as the default contact',
|
|
},
|
|
};
|
|
|
|
export default {
|
|
setup() {
|
|
const t = useTranslate(i18n);
|
|
const editingContact = ref({});
|
|
|
|
const onSave = () => Toast(t('save'));
|
|
const onDelete = () => Toast(t('delete'));
|
|
|
|
return {
|
|
t,
|
|
onSave,
|
|
onDelete,
|
|
editingContact,
|
|
};
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less">
|
|
.demo-contact-edit {
|
|
.van-doc-demo-block__title {
|
|
padding-bottom: 0;
|
|
}
|
|
}
|
|
</style>
|