mirror of
https://github.com/youzan/vant.git
synced 2025-12-18 02:06:02 +08:00
[Improvement] ContactCard add 'editable' prop (#435)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="van-contact-card" :class="`van-contact-card--${type}`" v-on="$listeners">
|
||||
<div class="van-contact-card" :class="[`van-contact-card--${type}`, { 'van-contact-card--uneditable': !editable }]" @click="onClick">
|
||||
<div class="van-contact-card__content">
|
||||
<template v-if="type === 'add'">
|
||||
<icon class="van-contact-card__icon" name="add2" />
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<icon class="van-contact-card__arrow" name="arrow" />
|
||||
<icon v-if="editable" class="van-contact-card__arrow" name="arrow" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -27,10 +27,22 @@ export default create({
|
||||
tel: String,
|
||||
name: String,
|
||||
addText: String,
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'add'
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick(event) {
|
||||
if (this.editable) {
|
||||
this.$emit('click', event);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user