feat(AddressEdit): add new prop disable-area (#5630)

This commit is contained in:
rex 2020-02-07 10:57:36 +08:00 committed by GitHub
parent d97e679e68
commit fd9cd12fe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -73,6 +73,9 @@ export default {
| show-delete | Whether to show delete button | *boolean* | `false` | | show-delete | Whether to show delete button | *boolean* | `false` |
| show-set-default | Whether to show default address switch | *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-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 | Whether to disable area select | *boolean* | `false` |
| save-button-text | Save button text | *string* | `Save` | | save-button-text | Save button text | *string* | `Save` |
| delete-button-text | Delete button text | *string* | `Delete` | | delete-button-text | Delete button text | *string* | `Delete` |
| detail-rows | Detail input rows | *number \| string* | `1` | | detail-rows | Detail input rows | *number \| string* | `1` |

View File

@ -73,6 +73,9 @@ export default {
| show-delete | 是否显示删除按钮 | *boolean* | `false` | | show-delete | 是否显示删除按钮 | *boolean* | `false` |
| show-set-default | 是否显示默认地址栏 | *boolean* | `false` | | show-set-default | 是否显示默认地址栏 | *boolean* | `false` |
| show-search-result | 是否显示搜索结果 | *boolean* | `false` | | show-search-result | 是否显示搜索结果 | *boolean* | `false` |
| show-area | 是否显示地区 | *boolean* | `true` |
| show-detail | 是否显示详细地址 | *boolean* | `true` |
| disable-area | 是否禁用地区选择 | *boolean* | `false` |
| save-button-text | 保存按钮文字 | *string* | `保存` | | save-button-text | 保存按钮文字 | *string* | `保存` |
| delete-button-text | 删除按钮文字 | *string* | `删除` | | delete-button-text | 删除按钮文字 | *string* | `删除` |
| detail-rows | 详细地址输入框行数 | *number \| string* | `1` | | detail-rows | 详细地址输入框行数 | *number \| string* | `1` |

View File

@ -52,6 +52,7 @@ export default createComponent({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
disableArea: Boolean,
detailRows: { detailRows: {
type: [Number, String], type: [Number, String],
default: 1, default: 1,
@ -250,7 +251,7 @@ export default createComponent({
}, },
render() { render() {
const { data, errorInfo, searchResult } = this; 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 // hide bottom field when use search && detail get focused
@ -280,15 +281,15 @@ export default createComponent({
<Field <Field
vShow={this.showArea} vShow={this.showArea}
readonly readonly
clickable clickable={!disableArea}
label={t('area')} label={t('area')}
placeholder={t('areaPlaceholder')} placeholder={t('areaPlaceholder')}
errorMessage={errorInfo.areaCode} errorMessage={errorInfo.areaCode}
rightIcon="arrow" rightIcon={!disableArea ? 'arrow' : null}
value={this.areaText} value={this.areaText}
onFocus={onFocus('areaCode')} onFocus={onFocus('areaCode')}
onClick={() => { onClick={() => {
this.showAreaPopup = true; this.showAreaPopup = !disableArea;
}} }}
/> />
<Detail <Detail