docs: prettier all markdown files

This commit is contained in:
chenjiahan
2020-04-11 09:17:33 +08:00
committed by neverland
parent 48067f79db
commit 7f84f8a487
140 changed files with 4441 additions and 4723 deletions
+55 -53
View File
@@ -35,8 +35,8 @@ export default {
data() {
return {
areaList,
searchResult: []
}
searchResult: [],
};
},
methods: {
onSave() {
@@ -47,16 +47,18 @@ export default {
},
onChangeDetail(val) {
if (val) {
this.searchResult = [{
name: '黄龙万科中心',
address: '杭州市西湖区'
}];
this.searchResult = [
{
name: '黄龙万科中心',
address: '杭州市西湖区',
},
];
} else {
this.searchResult = [];
}
}
}
}
},
},
};
```
## API
@@ -64,33 +66,33 @@ export default {
### Props
| Attribute | Description | Type | Default |
|------|------|------|------|
| area-list | Area List | *object* | - |
| area-columns-placeholder `v2.2.5` | placeholder of area columns | *string[]* | `[]` |
| area-placeholder | placeholder of area input field | *string* | `Area` |
| address-info | Address Info | *AddressInfo* | `{}` |
| search-result | Address search result | *SearchResult[]* | `[]` |
| show-postal | Whether to show postal field | *boolean* | `false` |
| show-delete | Whether to show delete button | *boolean* | `false` |
| show-set-default | Whether to show default address switch | *boolean* | `false` |
| show-search-result | Whether to show address search result | *boolean* | `false` |
| show-area | Whether to show area cell | *boolean* | `true` |
| show-detail | Whether to show detail field | *boolean* | `true` |
| disable-area `v2.5.0` | Whether to disable area select | *boolean* | `false` |
| save-button-text | Save button text | *string* | `Save` |
| delete-button-text | Delete button text | *string* | `Delete` |
| detail-rows | Detail input rows | *number \| string* | `1` |
| detail-maxlength `v2.0.4` | Detail maxlength | *number \| string* | `200` |
| is-saving | Whether to show save button loading status | *boolean* | `false` |
| is-deleting | Whether to show delete button loading status | *boolean* | `false` |
| tel-validator | The method to validate tel | *(tel: string) => boolean* | - |
| postal-validator `v2.1.2` | The method to validate postal | *(tel: string) => boolean* | - |
| validator | Custom validator | *(key, val) => string* | - |
| --- | --- | --- | --- |
| area-list | Area List | _object_ | - |
| area-columns-placeholder `v2.2.5` | placeholder of area columns | _string[]_ | `[]` |
| area-placeholder | placeholder of area input field | _string_ | `Area` |
| address-info | Address Info | _AddressInfo_ | `{}` |
| search-result | Address search result | _SearchResult[]_ | `[]` |
| show-postal | Whether to show postal field | _boolean_ | `false` |
| show-delete | Whether to show delete button | _boolean_ | `false` |
| show-set-default | Whether to show default address switch | _boolean_ | `false` |
| show-search-result | Whether to show address search result | _boolean_ | `false` |
| show-area | Whether to show area cell | _boolean_ | `true` |
| show-detail | Whether to show detail field | _boolean_ | `true` |
| disable-area `v2.5.0` | Whether to disable area select | _boolean_ | `false` |
| save-button-text | Save button text | _string_ | `Save` |
| delete-button-text | Delete button text | _string_ | `Delete` |
| detail-rows | Detail input rows | _number \| string_ | `1` |
| detail-maxlength `v2.0.4` | Detail maxlength | _number \| string_ | `200` |
| is-saving | Whether to show save button loading status | _boolean_ | `false` |
| is-deleting | Whether to show delete button loading status | _boolean_ | `false` |
| tel-validator | The method to validate tel | _(tel: string) => boolean_ | - |
| postal-validator `v2.1.2` | The method to validate postal | _(tel: string) => boolean_ | - |
| validator | Custom validator | _(key, val) => string_ | - |
### Events
| Event | Description | Arguments |
|------|------|------|
| --- | --- | --- |
| save | Triggered when click save button | contentform content |
| focus | Triggered when focus field | key: field name |
| delete | Triggered when confirm delete | contentform content |
@@ -103,39 +105,39 @@ export default {
### Slots
| Name | Description |
|------|------|
| Name | Description |
| ------- | --------------------------- |
| default | Custom content below postal |
### Methods
Use [ref](https://vuejs.org/v2/api/#ref) to get AddressEdit instance and call instance methods
| Name | Description | Attribute | Return value |
|------|------|------|------|
| setAddressDetail | Set address detail | addressDetail: string | - |
| Name | Description | Attribute | Return value |
| ---------------- | ------------------ | --------------------- | ------------ |
| setAddressDetail | Set address detail | addressDetail: string | - |
### AddressInfo Data Structure
| key | Description | Type |
|------|------|------|
| id | Address Id | *number \| string* |
| name | Name | *string* |
| tel | Phone | *string* |
| province | Province | *string* |
| city | City | *string* |
| county | County | *string* |
| addressDetail | Detailed Address | *string* |
| areaCode | Area code | *string* |
| postalCode | Postal code | *string* |
| isDefault | Is default address | *boolean* |
| key | Description | Type |
| ------------- | ------------------ | ------------------ |
| id | Address Id | _number \| string_ |
| name | Name | _string_ |
| tel | Phone | _string_ |
| province | Province | _string_ |
| city | City | _string_ |
| county | County | _string_ |
| addressDetail | Detailed Address | _string_ |
| areaCode | Area code | _string_ |
| postalCode | Postal code | _string_ |
| isDefault | Is default address | _boolean_ |
### SearchResult Data Structure
| key | Description | Type |
|------|------|------|
| name | Name | *string* |
| address | Address | *string* |
| key | Description | Type |
| ------- | ----------- | -------- |
| name | Name | _string_ |
| address | Address | _string_ |
### Area Data Structure
+55 -53
View File
@@ -35,8 +35,8 @@ export default {
data() {
return {
areaList,
searchResult: []
}
searchResult: [],
};
},
methods: {
onSave() {
@@ -47,16 +47,18 @@ export default {
},
onChangeDetail(val) {
if (val) {
this.searchResult = [{
name: '黄龙万科中心',
address: '杭州市西湖区'
}];
this.searchResult = [
{
name: '黄龙万科中心',
address: '杭州市西湖区',
},
];
} else {
this.searchResult = [];
}
}
}
}
},
},
};
```
## API
@@ -64,33 +66,33 @@ export default {
### Props
| 参数 | 说明 | 类型 | 默认值 |
|------|------|------|------|
| area-list | 地区列表 | *object* | - |
| area-columns-placeholder `v2.2.5` | 地区选择列占位提示文字 | *string[]* | `[]` |
| area-placeholder | 地区输入框占位提示文字 | *string* | `选择省 / 市 / 区` |
| address-info | 收货人信息初始值 | *AddressInfo* | `{}` |
| search-result | 详细地址搜索结果 | *SearchResult[]* | `[]` |
| show-postal | 是否显示邮政编码 | *boolean* | `false` |
| show-delete | 是否显示删除按钮 | *boolean* | `false` |
| show-set-default | 是否显示默认地址栏 | *boolean* | `false` |
| show-search-result | 是否显示搜索结果 | *boolean* | `false` |
| show-area | 是否显示地区 | *boolean* | `true` |
| show-detail | 是否显示详细地址 | *boolean* | `true` |
| disable-area `v2.5.0` | 是否禁用地区选择 | *boolean* | `false` |
| save-button-text | 保存按钮文字 | *string* | `保存` |
| delete-button-text | 删除按钮文字 | *string* | `删除` |
| detail-rows | 详细地址输入框行数 | *number \| string* | `1` |
| detail-maxlength `v2.0.4` | 详细地址最大长度 | *number \| string* | `200` |
| is-saving | 是否显示保存按钮加载动画 | *boolean* | `false` |
| is-deleting | 是否显示删除按钮加载动画 | *boolean* | `false` |
| tel-validator | 手机号格式校验函数 | *string => boolean* | - |
| postal-validator `v2.1.2` | 邮政编码格式校验函数 | *string => boolean* | - |
| validator | 自定义校验函数 | *(key, val) => string* | - |
| --- | --- | --- | --- |
| area-list | 地区列表 | _object_ | - |
| area-columns-placeholder `v2.2.5` | 地区选择列占位提示文字 | _string[]_ | `[]` |
| area-placeholder | 地区输入框占位提示文字 | _string_ | `选择省 / 市 / 区` |
| address-info | 收货人信息初始值 | _AddressInfo_ | `{}` |
| search-result | 详细地址搜索结果 | _SearchResult[]_ | `[]` |
| show-postal | 是否显示邮政编码 | _boolean_ | `false` |
| show-delete | 是否显示删除按钮 | _boolean_ | `false` |
| show-set-default | 是否显示默认地址栏 | _boolean_ | `false` |
| show-search-result | 是否显示搜索结果 | _boolean_ | `false` |
| show-area | 是否显示地区 | _boolean_ | `true` |
| show-detail | 是否显示详细地址 | _boolean_ | `true` |
| disable-area `v2.5.0` | 是否禁用地区选择 | _boolean_ | `false` |
| save-button-text | 保存按钮文字 | _string_ | `保存` |
| delete-button-text | 删除按钮文字 | _string_ | `删除` |
| detail-rows | 详细地址输入框行数 | _number \| string_ | `1` |
| detail-maxlength `v2.0.4` | 详细地址最大长度 | _number \| string_ | `200` |
| is-saving | 是否显示保存按钮加载动画 | _boolean_ | `false` |
| is-deleting | 是否显示删除按钮加载动画 | _boolean_ | `false` |
| tel-validator | 手机号格式校验函数 | _string => boolean_ | - |
| postal-validator `v2.1.2` | 邮政编码格式校验函数 | _string => boolean_ | - |
| validator | 自定义校验函数 | _(key, val) => string_ | - |
### Events
| 事件名 | 说明 | 回调参数 |
|------|------|------|
| --- | --- | --- |
| save | 点击保存按钮时触发 | content:表单内容 |
| focus | 输入框聚焦时触发 | key: 聚焦的输入框对应的 key |
| delete | 确认删除地址时触发 | content:表单内容 |
@@ -103,41 +105,41 @@ export default {
### Slots
| 名称 | 说明 |
|------|------|
| 名称 | 说明 |
| ------- | ---------------------- |
| default | 在邮政编码下方插入内容 |
### 方法
通过 ref 可以获取到 AddressEdit 实例并调用实例方法,详见[组件实例方法](#/zh-CN/quickstart#zu-jian-shi-li-fang-fa)
| 方法名 | 说明 | 参数 | 返回值 |
|------|------|------|------|
| setAddressDetail | 设置详细地址 | addressDetail: string | - |
| 方法名 | 说明 | 参数 | 返回值 |
| ---------------- | ------------ | --------------------- | ------ |
| setAddressDetail | 设置详细地址 | addressDetail: string | - |
### AddressInfo 数据格式
注意:AddressInfo 仅作为初始值传入,表单最终内容可以在 save 事件中获取
| key | 说明 | 类型 |
|------|------|------|
| id | 每条地址的唯一标识 | *number \| string* |
| name | 收货人姓名 | *string* |
| tel | 收货人手机号 | *string* |
| province | 省份 | *string* |
| city | 城市 | *string* |
| county | 区县 | *string* |
| addressDetail | 详细地址 | *string* |
| areaCode | 地区编码,通过`省市区选择`获取(必填) | *string* |
| postalCode | 邮政编码 | *string* |
| isDefault | 是否为默认地址 | *boolean* |
| key | 说明 | 类型 |
| ------------- | -------------------------------------- | ------------------ |
| id | 每条地址的唯一标识 | _number \| string_ |
| name | 收货人姓名 | _string_ |
| tel | 收货人手机号 | _string_ |
| province | 省份 | _string_ |
| city | 城市 | _string_ |
| county | 区县 | _string_ |
| addressDetail | 详细地址 | _string_ |
| areaCode | 地区编码,通过`省市区选择`获取(必填) | _string_ |
| postalCode | 邮政编码 | _string_ |
| isDefault | 是否为默认地址 | _boolean_ |
### SearchResult 数据格式
| key | 说明 | 类型 |
|------|------|------|
| name | 地名 | *string* |
| address | 详细地址 | *string* |
| key | 说明 | 类型 |
| ------- | -------- | -------- |
| name | 地名 | _string_ |
| address | 详细地址 | _string_ |
### 省市县列表数据格式
+7 -7
View File
@@ -107,7 +107,7 @@ export default createComponent({
if (province && province === city) {
arr.splice(1, 1);
}
return arr.filter(text => text).join('/');
return arr.filter((text) => text).join('/');
}
return '';
},
@@ -145,9 +145,9 @@ export default createComponent({
},
onAreaConfirm(values) {
values = values.filter(value => !!value);
values = values.filter((value) => !!value);
if (values.some(value => !value.code)) {
if (values.some((value) => !value.code)) {
Toast(t('areaEmpty'));
return;
}
@@ -183,7 +183,7 @@ export default createComponent({
items.push('postalCode');
}
const isValid = items.every(item => {
const isValid = items.every((item) => {
const msg = this.getErrorMessage(item);
if (msg) {
this.errorInfo[item] = msg;
@@ -261,7 +261,7 @@ export default createComponent({
render() {
const { data, errorInfo, searchResult, disableArea } = this;
const onFocus = name => () => this.onFocus(name);
const onFocus = (name) => () => this.onFocus(name);
// hide bottom field when use search && detail get focused
const hideBottomFields =
@@ -314,7 +314,7 @@ export default createComponent({
onFocus={onFocus('addressDetail')}
onBlur={this.onDetailBlur}
onInput={this.onChangeDetail}
onSelect-search={event => {
onSelect-search={(event) => {
this.$emit('select-search', event);
}}
/>
@@ -338,7 +338,7 @@ export default createComponent({
vModel={data.isDefault}
vShow={!hideBottomFields}
title={t('defaultAddress')}
onChange={event => {
onChange={(event) => {
this.$emit('change-default', event);
}}
/>