export default {
// components: {
// },
data() {
var validatePass = (rule, value, callback) => {
if (value === ‘‘) {
callback(new Error(‘请输入密码‘))
} else {
if (this.ruleForm.checkNewPsd !== ‘‘) {
this.$refs.ruleForm.validateField(‘checkNewPsd‘)
}
callback()
}
}
var validatePass2 = (rule, value, callback) => {
if (value === ‘‘) {
callback(new Error(‘请再次输入密码‘))
} else if (value !== this.ruleForm.newPsd) {
callback(new Error(‘两次输入密码不一致!‘))
} else {
callback()
}
}
return {
loading: false,
ruleForm: {},
userData: {},
rules: {
oldPsd: [{ required: true, message: ‘请输入密码‘, trigger: ‘blur‘ }],
newPsd: [{ validator: validatePass, trigger: ‘blur‘ }],
checkNewPsd: [{ validator: validatePass2, trigger: ‘blur‘ }]
}
}
}
}