data: function() {
var validateAccount = (rule,value,callback)=>{
var params = {
usrName:value,
}
let url=this.axios.urls.SYSTEM_USER_VEL;
this.axios.post(url, params).then(resp => {
if(!resp.data.success){
return callback(new Error(resp.data.msg));
}else{
callback();
}
//this.value = resp.date.rows.roleFlag;
}).catch();
};
return {
//表单验证
rules: {
usrName: [{
required: true,
message: '请输入用户!',
trigger: 'blur'
},
{
validator: validateAccount,
trigger: 'blur'
}]
}
}
}
ElementUi 自定义表单验证
最新推荐文章于 2024-05-22 18:10:50 发布