async-validator: ['username is required']
出现这种情况,去核对el-form-item 绑定的prop 与input内绑定的属性值是否一致,不一致则会出现这个BUG
<el-form-item label="姓名:" prop="name">
<el-input v-model="userInfo.username" style="width: 300px" />
</el-form-item>
userInfo: {
username: '',
password2: ''
},
rules: {
username: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
password2: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 3, max: 8, message: '密码长度在3-8以内', trigger: 'blur' }
]
}
确保 v-model双向绑定的数据 属性名与prop名字一致,也就是与rule 下的规则名一致
v-model=“userInfo.username”
el-form-item prop="username"
rules:{username:[xxxxx]}