diff --git a/components.js b/components.js index a836a1984..f9ab4301a 100644 --- a/components.js +++ b/components.js @@ -70,4 +70,7 @@ module.exports = [ 'address-list', 'area', 'card', + 'contact-card', + 'contact-edit', + 'contact-list', ]; diff --git a/src/contact-card/demo/index.vue b/src/contact-card/demo/index.vue index c1968e315..e4c52e05f 100644 --- a/src/contact-card/demo/index.vue +++ b/src/contact-card/demo/index.vue @@ -8,7 +8,7 @@ @click="showList = true" /> - + - + -) { - const { type, editable } = props; - - function onClick(event: Event) { - if (editable) { - emit(ctx, 'click', event); - } - } - - function Content() { - if (type === 'add') { - return props.addText || t('addText'); - } - - return [ -
{`${t('name')}:${props.name}`}
, -
{`${t('tel')}:${props.tel}`}
, - ]; - } - - return ( - - {Content()} - - ); -} - -ContactCard.props = { - tel: String, - name: String, - addText: String, - editable: { - type: Boolean, - default: true, - }, - type: { - type: String, - default: 'add', - }, -}; - -export default createComponent(ContactCard); diff --git a/src/contact-edit/index.js b/src/contact-edit/index.js index 6ca3a97bd..5189b24ad 100644 --- a/src/contact-edit/index.js +++ b/src/contact-edit/index.js @@ -33,6 +33,8 @@ export default createComponent({ }, }, + emits: ['save', 'delete', 'change-default'], + data() { return { data: { @@ -121,19 +123,21 @@ export default createComponent({ {this.showSetDefault && ( ( + { + this.$emit('change-default', event); + }} + /> + ), + }} title={this.setDefaultLabel} class={bem('switch-cell')} border={false} - > - { - this.$emit('change-default', event); - }} - /> - + > )}
- - ); -} - -ContactList.props = { - value: null as any, - list: Array, - addText: String, - defaultTagText: String, -}; - -export default createComponent(ContactList); diff --git a/vant.config.js b/vant.config.js index 569e74d63..c55cf1b70 100644 --- a/vant.config.js +++ b/vant.config.js @@ -339,10 +339,10 @@ module.exports = { path: 'card', title: 'Card 商品卡片', }, - // { - // path: 'contact-card', - // title: 'Contact 联系人', - // }, + { + path: 'contact-card', + title: 'Contact 联系人', + }, // { // path: 'coupon-list', // title: 'Coupon 优惠券', @@ -673,10 +673,10 @@ module.exports = { path: 'card', title: 'Card', }, - // { - // path: 'contact-card', - // title: 'Contact', - // }, + { + path: 'contact-card', + title: 'Contact', + }, // { // path: 'coupon-list', // title: 'Coupon',