diff --git a/components/DateRangePicker/DateRangePicker.vue b/components/DateRangePicker/DateRangePicker.vue index 0c2967f..04c9ca7 100644 --- a/components/DateRangePicker/DateRangePicker.vue +++ b/components/DateRangePicker/DateRangePicker.vue @@ -317,6 +317,16 @@ export default { if (!day || this.isDisabled(day)) return const selectedDate = this.getDateFromDay(day) + + // 如果设置了最小预订天数,则自动计算结束日期 + if (this.minBookingDays > 0) { + this.tempStartDate = selectedDate + const endDate = new Date(selectedDate) + endDate.setDate(selectedDate.getDate() + this.minBookingDays - 1) + this.tempEndDate = endDate + this.selectionState = 'completed' + return + } // 如果已有完整的日期区间(开始日期和结束日期都存在),重置选择 if (this.tempStartDate && this.tempEndDate && this.selectionState === 'completed') {