Skip to content

Commit dcb10aa

Browse files
fix(calendar-view): [calendar-view] Fix bug with invalid calendar hei… (#2520)
* fix(calendar-view): [calendar-view] Fix bug with invalid calendar height value * fix(calendar-view): [calendar-view] Fix bug
1 parent 77bbae0 commit dcb10aa

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

examples/sites/demos/apis/calendar-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default {
4343
},
4444
{
4545
name: 'height',
46-
type: 'string',
46+
type: 'string | number',
4747
defaultValue: '',
4848
desc: {
4949
'zh-CN': '日历高度',

examples/sites/demos/pc/app/calendar-view/calendar-disabled-day.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { test, expect } from '@playwright/test'
33
test('日期禁用', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
55
await page.goto('calendar-view#calendar-disabled-day')
6-
const day10 = page.getByText('10').nth(3)
6+
const day10 = page.getByText('10').nth(1)
77
const day14 = page.getByText('14').nth(1)
8-
const day15 = page.getByText('15').nth(1)
8+
const day15 = page.getByText('15').nth(2)
99
await expect(day10).toHaveClass(/is-disabled/)
1010
await expect(day14).toHaveClass(/is-disabled/)
1111
await expect(day15).toHaveClass('date')

packages/theme/src/calendar-view/index.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
padding-top: 32px;
2424
border: 1px solid #ebebeb;
2525
background-color: var(--tv-CalendarView-bg-color);
26+
overflow: auto;
2627

2728
&__header {
2829
display: flex;

packages/vue/src/calendar-view/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const calendarViewProps = {
6666
}
6767
},
6868
height: {
69-
type: String,
69+
type: [String, Number],
7070
default: ''
7171
},
7272
markColor: {

packages/vue/src/calendar-view/src/pc.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="tiny-calendar-view">
2+
<div class="tiny-calendar-view" :style="{ 'height': typeof height === 'number' ? height + 'px' : height }">
33
<div class="tiny-calendar-view__header">
44
<div>
55
<tiny-button @click="toToday">{{ t('ui.calendarView.backToday') }}</tiny-button>
@@ -58,8 +58,8 @@
5858
day.isLast || day.isNext
5959
? 'is-next-or-last'
6060
: isToday(day) || isSelectedDate(day)
61-
? 'is-selected'
62-
: '',
61+
? 'is-selected'
62+
: '',
6363
day.disabled ? 'is-disabled' : ''
6464
]"
6565
>
@@ -133,7 +133,7 @@
133133
<icon-chevron-right></icon-chevron-right>
134134
</div>
135135
</div>
136-
<div v-if="state.mode === 'timeline'" class="tiny-calendar-view-week__timeline" :style="{ 'height': height }">
136+
<div v-if="state.mode === 'timeline'" class="tiny-calendar-view-week__timeline">
137137
<div class="day-times">
138138
<ul>
139139
<li v-for="(item, i) in state.dayTimes" :key="item.time" :class="i % 2 === 1 && 'is-odd-num'">
@@ -186,7 +186,7 @@
186186
</ul>
187187
</div>
188188
</div>
189-
<div v-if="state.mode === 'schedule'" class="tiny-calendar-view-week__schedule" :style="{ 'height': height }">
189+
<div v-if="state.mode === 'schedule'" class="tiny-calendar-view-week__schedule">
190190
<ul>
191191
<li v-for="(date, index) in state.weekDates" :key="date.value" style="width: 14.28%">
192192
<slot

0 commit comments

Comments
 (0)