<FormItem label="选择完成时间: ">
<DatePicker type="datetime" :value="form.time" format="yyyy-MM-dd HH:mm" @on-change="_changeDate"
style="width: 200px"></DatePicker>
</FormItem>
复制代码
- selectS为所选时间时间戳
- a为与当前时间的差
//修改时间
_changeDate(date, type) {
console.log(date, type);
this.form.time = date;
this.form.timeoutTime = (() => {
let a = '';
let selectTime = date;
let selectS = new Date(selectTime).getTime();
let nowS = new Date().getTime();
if (selectTime && (parseInt(selectS) + 60000 >= parseInt(nowS))) {
a = parseInt(selectS) - parseInt(nowS);
} else {
a = parseInt(selectS) - parseInt(nowS);
this.$Message.error('选择完成时间必须大于当前时间')
}
return selectS;
})();
},
复制代码