密码校验

This commit is contained in:
jqtmviyu@gmail.com 2021-01-13 16:57:34 +08:00
parent ad539e91ed
commit 2864a04f24

View File

@ -75,13 +75,13 @@ export default {
callback(new Error('请输入合法手机号')) callback(new Error('请输入合法手机号'))
} }
} }
const validatePassword = (rule, value, callback) => { // const validatePassword = (rule, value, callback) => {
if (value.length < 6) { // if (value.length < 6) {
callback(new Error('The password can not be less than 6 digits')) // callback(new Error('The password can not be less than 6 digits'))
} else { // } else {
callback() // callback()
} // }
} // }
return { return {
loginForm: { loginForm: {
mobile: '13800000002', mobile: '13800000002',
@ -94,7 +94,11 @@ export default {
{ required: true, trigger: 'blur', message: '手机号不能为空' }, { required: true, trigger: 'blur', message: '手机号不能为空' },
{ validator: validateUsername, trigger: 'blur' } { validator: validateUsername, trigger: 'blur' }
], ],
password: [{ required: true, trigger: 'blur', validator: validatePassword }] // password: [{ required: true, trigger: 'blur', validator: validatePassword }]
password: [
{ required: true, trigger: 'blur', message: '密码不能为空' },
{ min: 6, max: 16, trigger: 'blur', message: '密码必须在6到16位之间' }
]
}, },
loading: false, loading: false,
passwordType: 'password', passwordType: 'password',