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
24
25
26
27
28
29
30
31 @@ -484,41 +492,49 @@ exports[`formatter prop 1`] = ` 23
24
25
26
27
28
29
30
31 @@ -836,49 +852,49 @@ exports[`row-height prop 1`] = ` 23
24
25
26
27
28
29
30
31 @@ -1083,41 +1099,49 @@ exports[`should render title、footer、subtitle slot correctly 1`] = ` 23
24
25
26
27
28
29
30
31 diff --git a/packages/vant/src/calendar/test/__snapshots__/prop.spec.ts.snap b/packages/vant/src/calendar/test/__snapshots__/prop.spec.ts.snap index da5358299..d317ea6b0 100644 --- a/packages/vant/src/calendar/test/__snapshots__/prop.spec.ts.snap +++ b/packages/vant/src/calendar/test/__snapshots__/prop.spec.ts.snap @@ -170,41 +170,49 @@ exports[`lazy-render prop 1`] = ` 23
24
25
26
27
28
29
30
31 diff --git a/packages/vant/src/calendar/var.less b/packages/vant/src/calendar/var.less index 540cd2be5..2ccd3f6d0 100644 --- a/packages/vant/src/calendar/var.less +++ b/packages/vant/src/calendar/var.less @@ -13,6 +13,7 @@ @calendar-month-mark-font-size: 160px; @calendar-day-height: 64px; @calendar-day-font-size: var(--van-font-size-lg); +@calendar-day-margin-bottom: 4px; @calendar-range-edge-color: var(--van-white); @calendar-range-edge-background-color: var(--van-danger-color); @calendar-range-middle-color: var(--van-danger-color);