实现的方式:
option实现插件只能选取当前时间之后的时候(包括年月日)
handle实现插件能选取当前时间的时、分、秒,但是选择完毕之后,只要选择的时、分、秒小于当前时间,会自动填充为当前的时、分、秒
如图当前是2020-05-13 17:00;
年月日不能选取小于当前时间的,但是时分能选,但是点了ok之后,如果时间小于当前时间,会自动替换成当前时间
<el-date-picker
v-model="date"
type="datetime"
format="yyyy-MM-dd HH:mm"
start=""
:picker-options="option"
@change="handle"
placeholder="">
</el-date-picker>
data:{
option{
disabledDate:(time)=> {
return time.getTime() < Date.now()-1 * 24 * 3600 * 1000
}
}
},
methods:{
handle: function() {
var startAt = new Date(this.date) * 1000 /1000;
if(startAt < Date.now()) {
this.date = new Date();
}
},
}