[new feature] AddressEdit support custom tel validator (#673)

This commit is contained in:
neverland
2018-03-07 16:23:10 +08:00
committed by GitHub
parent 2aaf074416
commit 0482558471
6 changed files with 14 additions and 2 deletions
+5 -1
View File
@@ -126,6 +126,10 @@ export default create({
searchResult: {
type: Array,
default: () => []
},
telValidator: {
type: Function,
default: validateMobile
}
},
@@ -233,7 +237,7 @@ export default create({
case 'name':
return value ? value.length <= 15 ? '' : $t('nameOverlimit') : $t('nameEmpty');
case 'tel':
return validateMobile(value) ? '' : $t('telWrong');
return this.telValidator(value) ? '' : $t('telWrong');
case 'area_code':
return value ? +value !== -1 ? '' : $t('areaWrong') : $t('areaEmpty');
case 'address_detail':
+5 -1
View File
@@ -54,6 +54,10 @@ export default create({
tel: '',
name: ''
})
},
telValidator: {
type: Function,
default: validateMobile
}
},
@@ -84,7 +88,7 @@ export default create({
case 'name':
return value ? value.length <= 15 ? '' : this.$t('nameOverlimit') : this.$t('nameEmpty');
case 'tel':
return validateMobile(value) ? '' : this.$t('telInvalid');
return this.telValidator(value) ? '' : this.$t('telInvalid');
}
},