JS判断选择日期不能小于当前日期
comparDate(dateValue) {
return new Date().getTime() >= new Date(dateValue).getTime() + 3600 * 1000 * 24;
}
Element日期选择器picker-options设置可选区间
dateFormat () {
return {
"picker-options": {
disabledDate: time => {
let day1 = Date.parse("2022-11-17");
let day2 = Date.now();
if (day1 > day2) {
return time.getTime() > Date.parse("2022-11-17") || time.getTime() < Date.now() - 1000 * 60 * 60 * 24;
}
else {
return time.getTime() < Date.parse("2022-11-17") - 1000 * 60 * 60 * 24 ||
time.getTime() > Date.now();
}
}
},
"value-format": "yyyy-MM-dd",
"format": "yyyy-MM-dd",
"type": "date"
}
},