效果1:开始时间不能选择当前日期之前的日期
效果2:结束时间不能选择开始日期之前的日期
<div>
开始时间:
<el-date-picker
v-model="value.promotionStartTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
:picker-options="pickerOptions0"
placeholder="选择开始时间">
</el-date-picker>
</div>
<div class="littleMargin">
结束时间:
<el-date-picker
v-model="value.promotionEndTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
:picker-options="pickerOptions1"
placeholder="选择结束时间">
</el-date-picker>
</div>
computed: {
pickerOptions0() {
return {
disabledDate: (time) => {
if (this.value.promotionEndTime) {
return time.getTime() > new Date(this.value.promotionEndTime).getTime()
}else{
return time.getTime() < Date.now() - 8.64e7
}
}
}
},
pickerOptions1() {
return {
disabledDate: (time) => {
if(this.value.promotionStartTime){
return time.getTime() < new Date(this.value.promotionStartTime).getTime()
}else {
return time.getTime() < Date.now() - 8.64e7
}
}
}
},
},