[improvement] AddressEdit: optimize area label (#1785)

This commit is contained in:
neverland 2018-09-12 11:58:12 +08:00 committed by GitHub
parent 374858af19
commit d69f77200e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -166,9 +166,14 @@ export default create({
areaText() { areaText() {
const { province, city, county, areaCode } = this.data; const { province, city, county, areaCode } = this.data;
return province && city && county && areaCode if (province && city && county && areaCode) {
? `${province} ${city} ${county}` const arr = [province, city, county];
: ''; if (province === city) {
arr.shift();
}
return arr.join('/');
}
return '';
} }
}, },

View File

@ -147,7 +147,7 @@ exports[`create a AddressEdit with props 1`] = `
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body">
<input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="北京市 北京市 朝阳区" class="van-field__control"> <input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="北京市/朝阳区" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->