Check the official documentation, in disabledDate, the range of time.getTime() is the disabled time range
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
}
The component code is like this:
<el-date-picker
v-model="value1"
type="date"
placeholder="选择日期"
:picker-options="pickerOptions">
</el-date-picker>
But in this way, the date of the day is also disabled. If you want to not disable today's date, you can do this
pickerOptions: {
disabledDate(time) {
// 在科学计数法中,为了使公式简便,可以用带“E”的格式表示。例如1.03乘10的8次方,可简写为“1.03e8”的形式
// 一天是24*60*60*1000 = 86400000 = 8.64e7
return time.getTime() < Date.now()-8.64e7;
},
}
If you still want to disable the range of a specific date, you can store this date in a field of data, and then get the data of this date for calculation when selecting
pickerOptions: {
disabledDate:(time)=> {
return time.getTime() < new Date(this.time).getTime();
}
}