vue3 已经取消了 picker-options 参数,不过我们可以用 calendar-change 和 disabled-date 代替
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator="-"
@calendar-change="calendarChange"
:disabled-date="disabledDate"
/>
const chooseDate = ref(null);
const calendarChange = (val: Date[]) => {
chooseDate.value = val[0];
};
const disabledDate = (time: number) => {
// 时间范围不能超过当前日期的前两个月
let end = dayjs(chooseDate.value).add(2, "month").valueOf()
let start = dayjs(chooseDate.value).subtract(2, "month").valueOf()
if (chooseDate.value) {
return time.getTime() > end || time.getTime() < start
}
};
1万+

被折叠的 条评论
为什么被折叠?



