问题描述
form.传参直接被识别为form对象的子项
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
data(){
return{
form: {
mail: "",
phone: '',
password: '',
Repeatpass: "",
verification_code: "",
},
}
}
methods:{
errmess() {
this.verification(mail,email,"邮箱","aaaaaa")
console.log(this.formerr)
},
verification(object,method,val,message) {
if (is.required(this.form.object)!=true) {
console.log(this.form.object);
this.formerr.object.push(val+"为必填项");
this.only=false
}
if(is.method(this.form.object)!=true){
this.only=false
this.formerr.object.push(message)
}
},
}
this.form.object 应该是随着object值改变的而不是被识别成form下的object
form[object]就可以了