diff --git a/packages/vant/src/calendar/CalendarDay.tsx b/packages/vant/src/calendar/CalendarDay.tsx index 99945a8ab..335f704d4 100644 --- a/packages/vant/src/calendar/CalendarDay.tsx +++ b/packages/vant/src/calendar/CalendarDay.tsx @@ -54,6 +54,10 @@ export default defineComponent({ } } + if (offset + (item.date?.getDate() || 1) > 28) { + style.marginBottom = 0; + } + return style; }); diff --git a/packages/vant/src/calendar/README.md b/packages/vant/src/calendar/README.md index 3fda11f1e..0ed91df18 100644 --- a/packages/vant/src/calendar/README.md +++ b/packages/vant/src/calendar/README.md @@ -395,6 +395,7 @@ The component provides the following CSS variables, which can be used to customi | --van-calendar-month-mark-font-size | _160px_ | - | | --van-calendar-day-height | _64px_ | - | | --van-calendar-day-font-size | _var(--van-font-size-lg)_ | - | +| --van-calendar-day-margin-bottom | _4px_ | - | | --van-calendar-range-edge-color | _var(--van-white)_ | - | | --van-calendar-range-edge-background-color | _var(--van-danger-color)_ | - | | --van-calendar-range-middle-color | _var(--van-danger-color)_ | - | diff --git a/packages/vant/src/calendar/README.zh-CN.md b/packages/vant/src/calendar/README.zh-CN.md index a5a91c1de..9e498ec6f 100644 --- a/packages/vant/src/calendar/README.zh-CN.md +++ b/packages/vant/src/calendar/README.zh-CN.md @@ -401,6 +401,7 @@ calendarRef.value?.reset(); | --van-calendar-month-mark-font-size | _160px_ | - | | --van-calendar-day-height | _64px_ | - | | --van-calendar-day-font-size | _var(--van-font-size-lg)_ | - | +| --van-calendar-day-margin-bottom | _4px_ | - | | --van-calendar-range-edge-color | _var(--van-white)_ | - | | --van-calendar-range-edge-background-color | _var(--van-danger-color)_ | - | | --van-calendar-range-middle-color | _var(--van-danger-color)_ | - | diff --git a/packages/vant/src/calendar/index.less b/packages/vant/src/calendar/index.less index da2af3449..dacd5ce39 100644 --- a/packages/vant/src/calendar/index.less +++ b/packages/vant/src/calendar/index.less @@ -14,6 +14,7 @@ --van-calendar-month-mark-font-size: @calendar-month-mark-font-size; --van-calendar-day-height: @calendar-day-height; --van-calendar-day-font-size: @calendar-day-font-size; + --van-calendar-day-margin-bottom: @calendar-day-margin-bottom; --van-calendar-range-edge-color: @calendar-range-edge-color; --van-calendar-range-edge-background-color: @calendar-range-edge-background-color; --van-calendar-range-middle-color: @calendar-range-middle-color; @@ -124,6 +125,7 @@ width: 14.285%; height: var(--van-calendar-day-height); font-size: var(--van-calendar-day-font-size); + margin-bottom: var(--van-calendar-day-margin-bottom); cursor: pointer; &--end, diff --git a/packages/vant/src/calendar/test/__snapshots__/index.spec.ts.snap b/packages/vant/src/calendar/test/__snapshots__/index.spec.ts.snap index 313e618ca..fd45e51b3 100644 --- a/packages/vant/src/calendar/test/__snapshots__/index.spec.ts.snap +++ b/packages/vant/src/calendar/test/__snapshots__/index.spec.ts.snap @@ -251,41 +251,49 @@ exports[`color prop when type is single 1`] = ` 23