mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] AddressEdit: add show-delete prop (#716)
This commit is contained in:
parent
f9445ba4ee
commit
4ae26ac8be
@ -4,6 +4,7 @@
|
|||||||
<van-address-edit
|
<van-address-edit
|
||||||
:area-list="areaList"
|
:area-list="areaList"
|
||||||
show-postal
|
show-postal
|
||||||
|
show-delete
|
||||||
show-set-default
|
show-set-default
|
||||||
show-search-result
|
show-search-result
|
||||||
:search-result="searchResult"
|
:search-result="searchResult"
|
||||||
|
@ -16,6 +16,7 @@ Vue.use(AddressEdit);
|
|||||||
<van-address-edit
|
<van-address-edit
|
||||||
:area-list="areaList"
|
:area-list="areaList"
|
||||||
show-postal
|
show-postal
|
||||||
|
show-delete
|
||||||
show-set-default
|
show-set-default
|
||||||
show-search-result
|
show-search-result
|
||||||
:search-result="searchResult"
|
:search-result="searchResult"
|
||||||
@ -64,6 +65,7 @@ export default {
|
|||||||
| address-info | Address Info | `Object` | `{}` | - |
|
| address-info | Address Info | `Object` | `{}` | - |
|
||||||
| search-result | Address search result | `Array` | `[]` | - |
|
| search-result | Address search result | `Array` | `[]` | - |
|
||||||
| show-postal | Whether to show postal field | `Boolean` | `false` | - |
|
| 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-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` | - |
|
||||||
| is-saving | Whether to show save button loading status | `Boolean` | `false` | - |
|
| is-saving | Whether to show save button loading status | `Boolean` | `false` | - |
|
||||||
|
@ -15,6 +15,7 @@ Vue.use(AddressEdit);
|
|||||||
<van-address-edit
|
<van-address-edit
|
||||||
:area-list="areaList"
|
:area-list="areaList"
|
||||||
show-postal
|
show-postal
|
||||||
|
show-delete
|
||||||
show-set-default
|
show-set-default
|
||||||
show-search-result
|
show-search-result
|
||||||
:search-result="searchResult"
|
:search-result="searchResult"
|
||||||
@ -63,6 +64,7 @@ export default {
|
|||||||
| search-result | 详细地址搜索结果 | `Array` | `[]` | - |
|
| search-result | 详细地址搜索结果 | `Array` | `[]` | - |
|
||||||
| address-text | "地址"文案前缀 | `String` | `收货` | - |
|
| address-text | "地址"文案前缀 | `String` | `收货` | - |
|
||||||
| show-postal | 是否显示邮政编码 | `Boolean` | `false` | - |
|
| show-postal | 是否显示邮政编码 | `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` | - |
|
||||||
| is-saving | 是否显示保存按钮加载动画 | `Boolean` | `false` | - |
|
| is-saving | 是否显示保存按钮加载动画 | `Boolean` | `false` | - |
|
||||||
|
12
package.json
12
package.json
@ -62,9 +62,9 @@
|
|||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"codecov": "^3.0.0",
|
"codecov": "^3.0.0",
|
||||||
"cross-env": "^5.1.4",
|
"cross-env": "^5.1.4",
|
||||||
"css-loader": "^0.28.10",
|
"css-loader": "^0.28.11",
|
||||||
"dependency-tree": "^6.0.1",
|
"dependency-tree": "^6.0.1",
|
||||||
"eslint": "^4.18.2",
|
"eslint": "^4.19.0",
|
||||||
"eslint-plugin-vue": "^4.3.0",
|
"eslint-plugin-vue": "^4.3.0",
|
||||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||||
"fast-vue-md-loader": "^1.0.3",
|
"fast-vue-md-loader": "^1.0.3",
|
||||||
@ -80,10 +80,10 @@
|
|||||||
"karma-spec-reporter": "^0.0.32",
|
"karma-spec-reporter": "^0.0.32",
|
||||||
"karma-webpack": "^2.0.13",
|
"karma-webpack": "^2.0.13",
|
||||||
"mocha": "^5.0.4",
|
"mocha": "^5.0.4",
|
||||||
"postcss": "^6.0.19",
|
"postcss": "^6.0.20",
|
||||||
"postcss-calc": "^6.0.0",
|
"postcss-calc": "^6.0.0",
|
||||||
"postcss-easy-import": "^3.0.0",
|
"postcss-easy-import": "^3.0.0",
|
||||||
"postcss-loader": "^2.1.1",
|
"postcss-loader": "^2.1.2",
|
||||||
"precss": "2.0.0",
|
"precss": "2.0.0",
|
||||||
"progress-bar-webpack-plugin": "^1.11.0",
|
"progress-bar-webpack-plugin": "^1.11.0",
|
||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
@ -94,12 +94,12 @@
|
|||||||
"uppercamelcase": "^3.0.0",
|
"uppercamelcase": "^3.0.0",
|
||||||
"url-loader": "^1.0.1",
|
"url-loader": "^1.0.1",
|
||||||
"vant-doc": "1.0.4",
|
"vant-doc": "1.0.4",
|
||||||
"vue": "^2.5.16",
|
"vue": "2.5.16",
|
||||||
"vue-loader": "^14.2.1",
|
"vue-loader": "^14.2.1",
|
||||||
"vue-router": "^3.0.1",
|
"vue-router": "^3.0.1",
|
||||||
"vue-sfc-compiler": "^0.0.8",
|
"vue-sfc-compiler": "^0.0.8",
|
||||||
"vue-style-loader": "^4.0.2",
|
"vue-style-loader": "^4.0.2",
|
||||||
"vue-template-compiler": "^2.5.16",
|
"vue-template-compiler": "2.5.16",
|
||||||
"vue-template-es2015-compiler": "^1.6.0",
|
"vue-template-es2015-compiler": "^1.6.0",
|
||||||
"webpack": "^4.1.1",
|
"webpack": "^4.1.1",
|
||||||
"webpack-cli": "^2.0.12",
|
"webpack-cli": "^2.0.12",
|
||||||
|
@ -119,6 +119,7 @@ export default create({
|
|||||||
isSaving: Boolean,
|
isSaving: Boolean,
|
||||||
isDeleting: Boolean,
|
isDeleting: Boolean,
|
||||||
areaList: Object,
|
areaList: Object,
|
||||||
|
showDelete: Boolean,
|
||||||
showPostal: Boolean,
|
showPostal: Boolean,
|
||||||
showSetDefault: Boolean,
|
showSetDefault: Boolean,
|
||||||
showSearchResult: Boolean,
|
showSearchResult: Boolean,
|
||||||
@ -144,7 +145,6 @@ export default create({
|
|||||||
...defaultAddress,
|
...defaultAddress,
|
||||||
...this.addressInfo
|
...this.addressInfo
|
||||||
},
|
},
|
||||||
isEdit: !!this.addressInfo.id,
|
|
||||||
detailFocused: false,
|
detailFocused: false,
|
||||||
errorInfo: {
|
errorInfo: {
|
||||||
name: false,
|
name: false,
|
||||||
@ -162,7 +162,6 @@ export default create({
|
|||||||
...defaultAddress,
|
...defaultAddress,
|
||||||
...val
|
...val
|
||||||
};
|
};
|
||||||
this.isEdit = !!val.id;
|
|
||||||
|
|
||||||
if (val.area_code) {
|
if (val.area_code) {
|
||||||
this.setAreaCode(val.area_code);
|
this.setAreaCode(val.area_code);
|
||||||
@ -190,6 +189,10 @@ export default create({
|
|||||||
|
|
||||||
areaListLoaded() {
|
areaListLoaded() {
|
||||||
return isObj(this.areaList) && Object.keys(this.areaList).length;
|
return isObj(this.areaList) && Object.keys(this.areaList).length;
|
||||||
|
},
|
||||||
|
|
||||||
|
isEdit() {
|
||||||
|
return this.showDelete || !!this.data.id;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
46
yarn.lock
46
yarn.lock
@ -59,7 +59,7 @@ acorn@^5.0.0, acorn@^5.4.0:
|
|||||||
version "5.4.1"
|
version "5.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102"
|
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102"
|
||||||
|
|
||||||
acorn@^5.2.1, acorn@^5.4.1:
|
acorn@^5.2.1, acorn@^5.4.1, acorn@^5.5.0:
|
||||||
version "5.5.3"
|
version "5.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9"
|
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9"
|
||||||
|
|
||||||
@ -2257,9 +2257,9 @@ css-color-names@0.0.4:
|
|||||||
version "0.0.4"
|
version "0.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
|
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
|
||||||
|
|
||||||
css-loader@^0.28.10:
|
css-loader@^0.28.11:
|
||||||
version "0.28.10"
|
version "0.28.11"
|
||||||
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.10.tgz#40282e79230f7bcb4e483efa631d670b735ebf42"
|
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.11.tgz#c3f9864a700be2711bb5a2462b2389b1a392dab7"
|
||||||
dependencies:
|
dependencies:
|
||||||
babel-code-frame "^6.26.0"
|
babel-code-frame "^6.26.0"
|
||||||
css-selector-tokenizer "^0.7.0"
|
css-selector-tokenizer "^0.7.0"
|
||||||
@ -3000,9 +3000,9 @@ eslint-visitor-keys@^1.0.0:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
|
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
|
||||||
|
|
||||||
eslint@^4.18.2:
|
eslint@^4.19.0:
|
||||||
version "4.18.2"
|
version "4.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.18.2.tgz#0f81267ad1012e7d2051e186a9004cc2267b8d45"
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.0.tgz#9e900efb5506812ac374557034ef6f5c3642fc4c"
|
||||||
dependencies:
|
dependencies:
|
||||||
ajv "^5.3.0"
|
ajv "^5.3.0"
|
||||||
babel-code-frame "^6.22.0"
|
babel-code-frame "^6.22.0"
|
||||||
@ -3013,7 +3013,7 @@ eslint@^4.18.2:
|
|||||||
doctrine "^2.1.0"
|
doctrine "^2.1.0"
|
||||||
eslint-scope "^3.7.1"
|
eslint-scope "^3.7.1"
|
||||||
eslint-visitor-keys "^1.0.0"
|
eslint-visitor-keys "^1.0.0"
|
||||||
espree "^3.5.2"
|
espree "^3.5.4"
|
||||||
esquery "^1.0.0"
|
esquery "^1.0.0"
|
||||||
esutils "^2.0.2"
|
esutils "^2.0.2"
|
||||||
file-entry-cache "^2.0.0"
|
file-entry-cache "^2.0.0"
|
||||||
@ -3035,6 +3035,7 @@ eslint@^4.18.2:
|
|||||||
path-is-inside "^1.0.2"
|
path-is-inside "^1.0.2"
|
||||||
pluralize "^7.0.0"
|
pluralize "^7.0.0"
|
||||||
progress "^2.0.0"
|
progress "^2.0.0"
|
||||||
|
regexpp "^1.0.1"
|
||||||
require-uncached "^1.0.3"
|
require-uncached "^1.0.3"
|
||||||
semver "^5.3.0"
|
semver "^5.3.0"
|
||||||
strip-ansi "^4.0.0"
|
strip-ansi "^4.0.0"
|
||||||
@ -3049,6 +3050,13 @@ espree@^3.5.2:
|
|||||||
acorn "^5.4.0"
|
acorn "^5.4.0"
|
||||||
acorn-jsx "^3.0.0"
|
acorn-jsx "^3.0.0"
|
||||||
|
|
||||||
|
espree@^3.5.4:
|
||||||
|
version "3.5.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7"
|
||||||
|
dependencies:
|
||||||
|
acorn "^5.5.0"
|
||||||
|
acorn-jsx "^3.0.0"
|
||||||
|
|
||||||
esprima@2.7.x, esprima@^2.1.0, esprima@^2.6.0, esprima@^2.7.1:
|
esprima@2.7.x, esprima@^2.1.0, esprima@^2.6.0, esprima@^2.7.1:
|
||||||
version "2.7.3"
|
version "2.7.3"
|
||||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
|
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
|
||||||
@ -6804,9 +6812,9 @@ postcss-load-plugins@^2.3.0:
|
|||||||
cosmiconfig "^2.1.1"
|
cosmiconfig "^2.1.1"
|
||||||
object-assign "^4.1.0"
|
object-assign "^4.1.0"
|
||||||
|
|
||||||
postcss-loader@^2.1.1:
|
postcss-loader@^2.1.2:
|
||||||
version "2.1.1"
|
version "2.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.1.tgz#208935af3b1d65e1abb1a870a912dd12e7b36895"
|
resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.2.tgz#03f54e23be736c9ea4f610e17d2a299254c05130"
|
||||||
dependencies:
|
dependencies:
|
||||||
loader-utils "^1.1.0"
|
loader-utils "^1.1.0"
|
||||||
postcss "^6.0.0"
|
postcss "^6.0.0"
|
||||||
@ -7070,6 +7078,14 @@ postcss@^6.0.19:
|
|||||||
source-map "^0.6.1"
|
source-map "^0.6.1"
|
||||||
supports-color "^5.2.0"
|
supports-color "^5.2.0"
|
||||||
|
|
||||||
|
postcss@^6.0.20:
|
||||||
|
version "6.0.20"
|
||||||
|
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.20.tgz#686107e743a12d5530cb68438c590d5b2bf72c3c"
|
||||||
|
dependencies:
|
||||||
|
chalk "^2.3.2"
|
||||||
|
source-map "^0.6.1"
|
||||||
|
supports-color "^5.3.0"
|
||||||
|
|
||||||
precinct@^4.0.0:
|
precinct@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/precinct/-/precinct-4.0.0.tgz#ce67108123b8ae7c156180fb3836c5e5de24654f"
|
resolved "https://registry.yarnpkg.com/precinct/-/precinct-4.0.0.tgz#ce67108123b8ae7c156180fb3836c5e5de24654f"
|
||||||
@ -7560,6 +7576,10 @@ regex-not@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
extend-shallow "^2.0.1"
|
extend-shallow "^2.0.1"
|
||||||
|
|
||||||
|
regexpp@^1.0.1:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.0.1.tgz#d857c3a741dce075c2848dcb019a0a975b190d43"
|
||||||
|
|
||||||
regexpu-core@^1.0.0:
|
regexpu-core@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b"
|
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b"
|
||||||
@ -9263,7 +9283,7 @@ vue-style-loader@^4.0.2:
|
|||||||
hash-sum "^1.0.2"
|
hash-sum "^1.0.2"
|
||||||
loader-utils "^1.0.2"
|
loader-utils "^1.0.2"
|
||||||
|
|
||||||
vue-template-compiler@^2.5.16:
|
vue-template-compiler@2.5.16:
|
||||||
version "2.5.16"
|
version "2.5.16"
|
||||||
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.16.tgz#93b48570e56c720cdf3f051cc15287c26fbd04cb"
|
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.16.tgz#93b48570e56c720cdf3f051cc15287c26fbd04cb"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -9274,7 +9294,7 @@ vue-template-es2015-compiler@^1.6.0:
|
|||||||
version "1.6.0"
|
version "1.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.6.0.tgz#dc42697133302ce3017524356a6c61b7b69b4a18"
|
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.6.0.tgz#dc42697133302ce3017524356a6c61b7b69b4a18"
|
||||||
|
|
||||||
vue@^2.5.16:
|
vue@2.5.16:
|
||||||
version "2.5.16"
|
version "2.5.16"
|
||||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.16.tgz#07edb75e8412aaeed871ebafa99f4672584a0085"
|
resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.16.tgz#07edb75e8412aaeed871ebafa99f4672584a0085"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user