[Enhancement] [date-picker] Month Range可以控制选择范围 #11864
icocoding
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Feature type:
Enhancement
Details
date-picker
Description
文件:element-plus/es/components/date-picker/src/date-picker-com/panel-month-range.mjs
添加一行代码,保持和其他类型一致,可以控制选择范围,比如月份选择不超过10个月。
代码:emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
具体位置:
const handleRangePick = (val, close = true) => {
const minDate_ = val.minDate;
const maxDate_ = val.maxDate;
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
return;
}
// added by etoneyang
emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
// added by etoneyang ---end---
maxDate.value = maxDate_;
minDate.value = minDate_;
if (!close)
return;
handleRangeConfirm();
};
Additional comments
(empty)
1 vote ·
Beta Was this translation helpful? Give feedback.
All reactions