1.如果定义的数组的,校验它的长度,规则里面必须写required: true,否则没有小*
//设置时间
let formStartTimeEndTime=(rule, value, callback)=>{
if(this.formSetDate!=null || this.formSetDate!=undefined){
if(this.formSetDate.length===0){
return callback(new Error('请选择开始时间和结束时间'));
}else{
callback();
}
}
};
rules: {
formSetDate: [{validator: formStartTimeEndTime,trigger: 'change',required: true, //一定要写它(required: true),否则小星星出不来,}],
},
网友评论