<el-date-picker
type="datetime"
v-model="transshipmentTime"
placeholder="请选择"
style="width: 100%;"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions" // 在这里配置
@change="handle" // 如果选择时间小于当前时间时,默认显示回当前时间
/>
data中
transshipmentTime: [],
pickerOptions: {
disabledDate:(time)=> {
return time.getTime() < Date.now()-1 * 24 * 3600 * 1000
}, // 禁用日期
selectableRange: `${Date().split(" ")[4]} - 23:59:59`, // 打开默认当前时间
}
methods
handle () {
var startAt = new Date(this.form.transshipmentTime) * 1000 /1000;
if(startAt < Date.now()) {
this.transshipmentTime = new Date();
}
},
原文链接:https://blog.csdn.net/qq_44712405/article/details/124800589
标签:此时此刻,startAt,transshipmentTime,之前,选择,Date,new,now,1000 From: https://www.cnblogs.com/baozhengrui/p/17775324.html