fix(calendar-view): [calendar-view] week display error (#1241)

* 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” <jevin@mogul-tech.com>
This commit is contained in:
Jevin 2024-01-09 15:22:37 +08:00 committed by GitHub
parent b9fe6eda7d
commit c50688a916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -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/)

View File

@ -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
@ -172,7 +172,7 @@
name="header"
:slot-scope="{
date: date.value,
weekDay: t(`ui.calendarView.weekDays[${index}]`)
weekDay: t(`ui.calendarView.weekDays.${index}`)
}"
>
<span
@ -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>

View File

@ -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">
@ -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'">
@ -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>