<el-form-item label="发布时间">
<el-date-picker
v-model="formData.startTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 175px"
:picker-options="pickerOptions1"
placeholder="选择开始时间"
>
</el-date-picker>
-
<el-date-picker
v-model="formData.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 175px"
:picker-options="pickerOptions2"
placeholder="选择结束时间"
>
</el-date-picker>
</el-form-item>
data() {
return {
pickerOptions1 : {
disabledDate:time=>{
let delay = this.formData.endTime;
if(delay){
return time.getTime() > new Date(delay).getTime();
}
},
},
pickerOptions2 : {
disabledDate:time=>{
let delay = this.formData.startTime;
if(delay){
return time.getTime() < new Date(delay).getTime();
}
},
},
}
}
当先输入开始时间时:
当先输入结束时间时: