vue elementui el-date-picker 结束时间大于开始时间
<el-form-item><el-date-picker type="date" format="yyyy-MM-dd" clearable value-format="yyyy-MM-dd"v-model="formItem.startDate" size="small" placeholder="开始日期" :picker-op...
·
<el-form-item>
<el-date-picker type="date" format="yyyy-MM-dd" clearable value-format="yyyy-MM-dd"
v-model="formItem.startDate" size="small" placeholder="开始日期" :picker-options="pickerOptionsStart">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-date-picker type="date" format="yyyy-MM-dd" clearable value-format="yyyy-MM-dd"
v-model="formItem.endDate" size="small" placeholder="结束日期" :picker-options="pickerOptionsEnd">
</el-date-picker>
</el-form-item>
formItem: {
startDate: '',
endDate: ''
}
pickerOptionsStart: {
disabledDate: time => {
const endDateVal = new Date(this.formItem.endDate).getTime()
if (endDateVal) {
return time.getTime() > endDateVal - 0
}
}
},
pickerOptionsEnd: {
disabledDate: time => {
const beginDateVal = new Date(this.formItem.startDate).getTime()
if (beginDateVal) {
return time.getTime() < beginDateVal - 0
}
}
}
更多推荐
已为社区贡献30条内容
所有评论(0)