Commit b897a4f6 authored by Davve's avatar Davve

验证密码长度

parent 65f8db4a
......@@ -118,6 +118,24 @@
callback()
}
}
const validatePasswordLength = (rule, value, callback) => {
if (value === '') {
this.$message({
message: rule.field + '为必传项',
type: 'error'
})
callback(new Error(rule.field + '为必传项'))
} else if ( value.length < 6) {
this.$message({
message: '密码不得少于6位',
type: 'error'
})
callback(new Error('密码不得少于6位'))
} else {
callback()
}
}
return {
postForm: Object.assign({}, defaultForm),
loading: false,
......@@ -126,7 +144,7 @@
username: [{validator: validateRequire}],
nick_name: [{validator: validateRequire}],
email: [{validator: validateRequire}],
password: [{validator: validateRequire}],
password: [{validator: validatePasswordLength}],
phone: [{validator: validateRequire}],
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment