Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<tiny-calendar :year="2000" :month="5" />
</template>

<script setup>
import { TinyCalendar } from '@opentiny/vue'
</script>
16 changes: 16 additions & 0 deletions examples/sites/demos/pc/app/calendar/calendar-year-month.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test'

test('日历年月显示测试', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('calendar#calendar-year-month')
const pcDemo = page.locator('.pc-demo')

// 验证初始化年月是否正确(2000年5月)
await expect(pcDemo.locator('.tiny-calendar__tool input').first()).toHaveValue('2000年')
await expect(pcDemo.locator('.tiny-calendar__tool input').nth(1)).toHaveValue('5 月')

// 验证年份视图下的月份显示
await pcDemo.locator('.tiny-calendar__tabs').getByText('年').click()
await expect(pcDemo.locator('.tiny-calendar__tool input').first()).toHaveValue('2000年')
await expect(pcDemo.getByRole('cell', { name: '5 月' }).locator('div').first()).toHaveClass(/selected/)
})
13 changes: 13 additions & 0 deletions examples/sites/demos/pc/app/calendar/calendar-year-month.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<tiny-calendar :year="2000" :month="5" />
</template>

<script>
import { TinyCalendar } from '@opentiny/vue'

export default {
components: {
TinyCalendar
}
}
</script>
13 changes: 13 additions & 0 deletions examples/sites/demos/pc/app/calendar/webdoc/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ export default {
},
codeFiles: ['show-selected-date.vue']
},
{
demoId: 'calendar-year-month',
name: {
'zh-CN': '指定年月',
'en-US': 'Specify Month and Year'
},
desc: {
'zh-CN': '<p>通过 <code>year</code> 属性指定年份,通过 <code>month</code> 属性指定月份。</p>\n',
'en-US':
'<p>Specify the year through the <code>year</code> attribute and the month through the <code>month</code> attribute. </p>\n'
},
codeFiles: ['calendar-year-month.vue']
},
{
demoId: 'custom-day-cell',
name: {
Expand Down
Loading