# AddressEdit
# 基础渲染
姓名
手机号码
所在区域
请选择所在区域
详细地址
是否设置为默认地址
<template>
<d-address-edit
:address-info="addressInfo"
:province="province"
:city="city"
:country="country"
@onChange="onChange"
@save="handleSave"></d-address-edit>
</template>
<script>
export default {
data () {
return {
addressInfo: {
detail: '',
defaultFlag: 0,
province: '',
city: '',
county: '',
districtCode: '',
receiver: '',
phoneNo: '',
id: '',
},
province: [
{ districtCode: 1, districtSimpleName: '北京' },
{ districtCode: 2, districtSimpleName: '广西' },
{ districtCode: 3, districtSimpleName: '江西' },
{ districtCode: 4, districtSimpleName: '岫岩满族自治县' },
], // 省
city: [
{ districtCode: 7, districtSimpleName: '朝阳区' },
{ districtCode: 8, districtSimpleName: '崇文区' },
{ districtCode: 9, districtSimpleName: '昌平区' },
{ districtCode: 6, districtSimpleName: '岫岩满族自治县' }
], // 市
country: [
{ districtCode: 3, districtSimpleName: '八里庄街道' },
{ districtCode: 9, districtSimpleName: '北苑' },
{ districtCode: 4, districtSimpleName: '岫岩满族自治县' }
] // 县
}
},
methods: {
handleClick() {
alert('hello');
},
handleSave (form) {
console.log(form);
},
onChange (cal) {
console.log(cal);
},
},
};
</script>
# # API
# # 属性
名称 | 说明 | 类型 | 默认值 |
province | 省 | array | function _default() { return []; } |
city | 市 | array | function _default() { return []; } |
country | 区 | array | function _default() { return []; } |
addressInfo | 保存的表单信息 | object | |
telValidator | function | function isMobile(value) { value = value.replace(/[^-|\d]/g, ''); return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value); } |
# # 插槽
无
# # 事件
名称 | 说明 | 参数 | ||||||
save | 点击保存地址按钮触发 |
| ||||||
onChange | 选择地区时触发 |
|