<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;
})();
},
複製代碼