mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
add ContactCard component
This commit is contained in:
parent
ae2c2dbe32
commit
add6fe3736
49
docs/examples-docs/contact.md
Normal file
49
docs/examples-docs/contact.md
Normal file
@ -0,0 +1,49 @@
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
## Contact 联系人
|
||||
|
||||
### 使用指南
|
||||
``` javascript
|
||||
import { ContactCard, ContactList, ContactEdit } from 'vant';
|
||||
|
||||
Vue.component(ContactCard.name, ContactCard);
|
||||
Vue.component(ContactList.name, ContactList);
|
||||
Vue.component(ContactEdit.name, ContactEdit);
|
||||
```
|
||||
|
||||
### 代码演示
|
||||
|
||||
#### 基础用法
|
||||
|
||||
:::demo 基础用法
|
||||
```html
|
||||
<van-contact-card></van-contact-card>
|
||||
<van-contact-card type="edit" ></van-contact-card>
|
||||
```
|
||||
|
||||
``` javascript
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
```
|
||||
:::
|
||||
|
||||
### Contact API
|
||||
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
| type | 类型,分为添加和编辑两种样式 | `String` | `add` | `edit` |
|
||||
| addText | 添加时的文案提示 | `String` | `添加订单联系人信息` | - |
|
||||
| username | 联系人姓名 | `String` | - | - |
|
||||
| tel | 联系人手机号 | `String` | - | - |
|
@ -226,6 +226,10 @@ module.exports = {
|
||||
"path": "/area",
|
||||
"title": "Area 省市区选择"
|
||||
},
|
||||
{
|
||||
"path": "/contact",
|
||||
"title": "Contact 联系人"
|
||||
},
|
||||
{
|
||||
"path": "/coupon",
|
||||
"title": "Coupon 优惠券选择器"
|
||||
|
47
packages/contact-card/index.vue
Normal file
47
packages/contact-card/index.vue
Normal file
@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div :class="['van-contact-card', `van-contact-card--${type}`]" v-on="$listeners">
|
||||
<div class="van-contact-card__content">
|
||||
<template v-if="type === 'add'">
|
||||
<van-icon class="van-contact-card__icon" name="add2" />
|
||||
<div class="van-contact-card__text">{{ addText }}</div>
|
||||
</template>
|
||||
<template v-else-if="type === 'edit'">
|
||||
<van-icon class="van-contact-card__icon" name="contact" />
|
||||
<div class="van-contact-card__text">
|
||||
<p>联系人:{{ username }}</p>
|
||||
<p>联系电话:{{ tel }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<van-icon class="van-contact-card__arrow" name="arrow" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Icon from '../icon';
|
||||
|
||||
export default {
|
||||
name: 'van-contact-card',
|
||||
|
||||
components: {
|
||||
[Icon.name]: Icon
|
||||
},
|
||||
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'add'
|
||||
},
|
||||
username: {
|
||||
type: String
|
||||
},
|
||||
tel: {
|
||||
type: String
|
||||
},
|
||||
addText: {
|
||||
type: String,
|
||||
default: '添加订单联系人信息'
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -12,6 +12,7 @@ import CellSwipe from './cell-swipe';
|
||||
import Checkbox from './checkbox';
|
||||
import CheckboxGroup from './checkbox-group';
|
||||
import Col from './col';
|
||||
import ContactCard from './contact-card';
|
||||
import CouponCell from './coupon-cell';
|
||||
import CouponList from './coupon-list';
|
||||
import DatetimePicker from './datetime-picker';
|
||||
@ -70,6 +71,7 @@ const components = [
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
Col,
|
||||
ContactCard,
|
||||
CouponCell,
|
||||
CouponList,
|
||||
DatetimePicker,
|
||||
@ -138,6 +140,7 @@ export {
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
Col,
|
||||
ContactCard,
|
||||
CouponCell,
|
||||
CouponList,
|
||||
DatetimePicker,
|
||||
|
@ -56,3 +56,4 @@
|
||||
@import './goods-action.css';
|
||||
@import './submit-bar.css';
|
||||
@import './sku.css';
|
||||
@import './contact-card.css';
|
||||
|
Loading…
x
Reference in New Issue
Block a user