首页 > 其他分享 >[element-ui] el-date-picker a-range-picker type=“daterange“ rules 校验

[element-ui] el-date-picker a-range-picker type=“daterange“ rules 校验

时间:2022-12-21 10:37:47浏览次数:40  
标签:picker el rules true required 日期 date message type


<el-form class="pl13" :rules="rules" ref="ruleForm" :model="searchKey">
<el-form-item prop="daterange">
<el-date-picker
v-model="value1"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
</el-form>
<el-form class="pl13" :rules="rules" ref="ruleForm" :model="searchKey">
<el-form-item prop="daterange">
<a-range-picker v-model="daterange"></a-range-picker>
</el-form-item>
</el-form>
rules: {
dateRange: [
{
type: 'array',
required: true,
message: '请选择日期区间',
fields: {
// tpye类型试情况而定,所以如果返回的是date就改成date,如果返回的是string就改成string
0: { type: 'date', required: true, message: '请选择开始日期' },
1: { type: 'date', required: true, message: '请选择结束日期' },
},
},
],
}


标签:picker,el,rules,true,required,日期,date,message,type
From: https://blog.51cto.com/u_12881709/5957926

相关文章