[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

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':