- rules: {
- phoneNumber: [
- { required: true, message: '请输入手机号码', trigger: 'blur' },
- {
- required: true,
- pattern: /^[1][3,4,5,7,8,9][0-9]{9}$/,
- message: '请输入正确的手机号码',
- trigger: 'blur',
- },
- ],
- },
- validatePhone(value) {
- const reg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
- if (value == '' || value == undefined || value == null) {
- return '';
- } else {
- if (!reg.test(value) && value != '') {
- return '请输入正确的手机号码';
- } else {
- return '';
- }
- }
- },