1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| computed: { rules () { var validateSurnmae = (rule, value, callback) => { let reg = /^[A-Za-z]+$/ if (!reg.test(value)) { callback(new Error(this.$t('joinUs.surnameErr3'))) } else { callback() } }; var validateGivenName = (rule, value, callback) => { let reg = /^[\u4e00-\u9fa5]+$/ if (!reg.test(value)) { callback(new Error(this.$t('joinUs.givenNameErr3'))) } else { callback() } }; return { surname: [ { required: true, message: this.$t('joinUs.surnameErr1'), trigger: "blur" }, { validator: validateSurnmae, trigger: "blur" }, { min: 1, max: 20, message: this.$t('joinUs.surnameErr2'), trigger: "blur" } ], givenName: [ { required: true, message: this.$t('joinUs.givenNameErr1'), trigger: "blur" }, { validator: validateGivenName, trigger: "blur" }, { min: 1, max: 20, message: this.$t('joinUs.givenNameErr2'), trigger: "blur" } ] email: [ { required: true, message: this.$t('joinUs.emailError'), trigger: "blur" }, { type: "email", message: this.$t('joinUs.emailError'), trigger: ["blur", "change"] } ], phoneNumber: [ { required: true, message: this.$t('joinUs.phoneNumberError1'), trigger: "blur" }, { type: 'number', message: this.$t('joinUs.phoneNumberError2'), trigger: "blur" } ] } } }
|