Skip to content

Commit

Permalink
fix(calendar-view): [calendar-view] week display error (#1241)
Browse files Browse the repository at this point in the history
* fix(calendar-view): week display error #1158

* fix(calendar-view): [calendar-view] week display error - mobile

* test(calendar-view): [calendar-view] amend e2e ttest

---------

Co-authored-by: “Jevin” <[email protected]>
  • Loading branch information
Jevin0 and “Jevin” authored Jan 9, 2024
1 parent b9fe6ed commit c50688a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('日期禁用', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('calendar-view#calendar-disabled-day')
const day10 = page.getByText('10').nth(1)
const day10 = page.getByText('10').nth(2)
const day14 = page.getByText('14').nth(1)
const day15 = page.getByText('15').nth(1)
await expect(day10).toHaveClass(/is-disabled/)
Expand Down
8 changes: 3 additions & 5 deletions packages/vue/src/calendar-view/src/mobile-first.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
<ul data-tag="tiny-calendar-view-monthlist" class="flex justify-around flex-1 h-full">
<li data-tag="tiny-calendar-view-monthitem" v-for="day in state.weekDays" :key="day" class="leading-10">
<span class="text-sm text-color-text-primary">{{ t(`ui.calendarView.weekDays[${day}]`) }}</span>
<span class="text-sm text-color-text-primary">{{ t(`ui.calendarView.weekDays.${day}`) }}</span>
</li>
</ul>
<div
Expand Down Expand Up @@ -172,7 +172,7 @@
name="header"
:slot-scope="{
date: date.value,
weekDay: t(`ui.calendarView.weekDays[${index}]`)
weekDay: t(`ui.calendarView.weekDays.${index}`)
}"
>
<span
Expand All @@ -189,9 +189,7 @@
<span
class="text-sm"
:class="[dateIsToday(date.value) ? 'text-color-brand' : 'text-color-text-placeholder']"
>{{
dateIsToday(date.value) ? t('ui.datepicker.today') : t(`ui.calendarView.weekDays[${index}]`)
}}</span
>{{ dateIsToday(date.value) ? t('ui.datepicker.today') : t(`ui.calendarView.weekDays.${index}`) }}</span
>
</slot>
</li>
Expand Down
6 changes: 3 additions & 3 deletions packages/vue/src/calendar-view/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
<ul class="header-main">
<li v-for="day in state.weekDays" :key="day">
<span>{{ t(`ui.calendarView.weekDays[${day}]`) }}</span>
<span>{{ t(`ui.calendarView.weekDays.${day}`) }}</span>
</li>
</ul>
<div class="header-right" @click="goNextMonth">
Expand Down Expand Up @@ -111,7 +111,7 @@
name="header"
:slot-scope="{
date: date.value,
weekDay: t(`ui.calendarView.weekDays[${index}]`)
weekDay: t(`ui.calendarView.weekDays.${index}`)
}"
>
<span class="date" :class="dateIsToday(date.value) && 'is-today'">
Expand All @@ -123,7 +123,7 @@
></span>
</span>
<span class="week-day" :class="dateIsToday(date.value) && 'is-today'">{{
dateIsToday(date.value) ? t('ui.datepicker.today') : t(`ui.calendarView.weekDays[${index}]`)
dateIsToday(date.value) ? t('ui.datepicker.today') : t(`ui.calendarView.weekDays.${index}`)
}}</span>
</slot>
</li>
Expand Down

0 comments on commit c50688a

Please sign in to comment.