<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(); } },